Logo Search packages:      
Sourcecode: chromium-browser version File versions  Download package


// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


#include <string>

#include "base/ref_counted.h"
#include "base/time.h"
#include "base/waitable_event.h"
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/cookie_prompt_modal_dialog_delegate.h"
#include "chrome/common/content_settings.h"
#include "googleurl/src/gurl.h"

// This class is used to request content setting related permission for local
// storage.  It should only be used for one such event and then discarded.
class DOMStoragePermissionRequest : public CookiePromptModalDialogDelegate {
  DOMStoragePermissionRequest(const GURL& url,
                              const string16& key,
                              const string16& value,
                              HostContentSettingsMap* settings);

  ContentSetting WaitOnResponse();

  const GURL& url() const { return url_; }
  const string16& key() const { return key_; }
  const string16& value() const { return value_; }

  // Called on the UI thread.
  static void PromptUser(DOMStoragePermissionRequest* request);

  // CookiesPromptViewDelegate methods:
  virtual void AllowSiteData(bool session_expire);
  virtual void BlockSiteData();

  void SendResponse(ContentSetting content_setting);

  // The URL we need to get permission for.
  const GURL url_;

  // The key we're trying to set.
  const string16 key_;

  // The value we're trying to set.
  const string16 value_;

  // The response to the permission request.
  ContentSetting response_content_setting_;

  // One time use.  Never reset.
  base::WaitableEvent event_;

  scoped_refptr<HostContentSettingsMap> host_content_settings_map_;



Generated by  Doxygen 1.6.0   Back to index