| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_PERMISSION_REQUEST_H_ | |
| 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_PERMISSION_REQUEST_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/ref_counted.h" | |
| 10 #include "base/string16.h" | |
| 11 #include "base/time.h" | |
| 12 #include "base/waitable_event.h" | |
| 13 #include "chrome/browser/host_content_settings_map.h" | |
| 14 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" | |
| 15 #include "chrome/common/content_settings.h" | |
| 16 #include "googleurl/src/gurl.h" | |
| 17 | |
| 18 // This class is used to request content setting related permission for local | |
| 19 // storage. It should only be used for one such event and then discarded. | |
| 20 class DOMStoragePermissionRequest : public CookiePromptModalDialogDelegate { | |
| 21 public: | |
| 22 DOMStoragePermissionRequest(const GURL& url, | |
| 23 const string16& key, | |
| 24 const string16& value, | |
| 25 HostContentSettingsMap* settings); | |
| 26 | |
| 27 | |
| 28 ContentSetting WaitOnResponse(); | |
| 29 | |
| 30 const GURL& url() const { return url_; } | |
| 31 const string16& key() const { return key_; } | |
| 32 const string16& value() const { return value_; } | |
| 33 | |
| 34 // Called on the UI thread. | |
| 35 static void PromptUser(DOMStoragePermissionRequest* request); | |
| 36 | |
| 37 // CookiesPromptViewDelegate methods: | |
| 38 virtual void AllowSiteData(bool session_expire); | |
| 39 virtual void BlockSiteData(); | |
| 40 | |
| 41 private: | |
| 42 void SendResponse(ContentSetting content_setting); | |
| 43 | |
| 44 // The URL we need to get permission for. | |
| 45 const GURL url_; | |
| 46 | |
| 47 // The key we're trying to set. | |
| 48 const string16 key_; | |
| 49 | |
| 50 // The value we're trying to set. | |
| 51 const string16 value_; | |
| 52 | |
| 53 // The response to the permission request. | |
| 54 ContentSetting response_content_setting_; | |
| 55 | |
| 56 // One time use. Never reset. | |
| 57 base::WaitableEvent event_; | |
| 58 | |
| 59 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | |
| 60 | |
| 61 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStoragePermissionRequest); | |
| 62 }; | |
| 63 | |
| 64 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_PERMISSION_REQUEST_H_ | |
| OLD | NEW |