| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_RENDERER_HOST_DATABASE_PERMISSION_REQUEST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_DATABASE_PERMISSION_REQUEST_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_DATABASE_PERMISSION_REQUEST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_DATABASE_PERMISSION_REQUEST_H_ |
| 7 | 7 |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" | 11 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" |
| 12 #include "chrome/common/content_settings.h" | 12 #include "chrome/common/content_settings.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 | 14 |
| 15 class HostContentSettingsMap; | 15 class HostContentSettingsMap; |
| 16 class Task; | 16 class Task; |
| 17 | 17 |
| 18 // This class is fully threadsafe. | 18 // This class is fully threadsafe. |
| 19 class DatabasePermissionRequest | 19 class DatabasePermissionRequest |
| 20 : public base::RefCountedThreadSafe<DatabasePermissionRequest>, | 20 : public base::RefCountedThreadSafe<DatabasePermissionRequest>, |
| 21 public CookiePromptModalDialogDelegate { | 21 public CookiePromptModalDialogDelegate { |
| 22 public: | 22 public: |
| 23 DatabasePermissionRequest(const GURL& url, | 23 DatabasePermissionRequest(const GURL& url, |
| 24 const string16& database_name, | 24 const string16& database_name, |
| 25 const string16& display_name, |
| 26 unsigned long estimated_size, |
| 25 Task* on_allow, | 27 Task* on_allow, |
| 26 Task* on_block, | 28 Task* on_block, |
| 27 HostContentSettingsMap* settings_map); | 29 HostContentSettingsMap* settings_map); |
| 28 ~DatabasePermissionRequest(); | 30 ~DatabasePermissionRequest(); |
| 29 | 31 |
| 30 const GURL& url() const { return url_; } | 32 const GURL& url() const { return url_; } |
| 31 const string16& database_name() const { return database_name_; } | 33 const string16& database_name() const { return database_name_; } |
| 34 const string16& display_name() const { return display_name_; } |
| 35 unsigned long estimated_size() const { return estimated_size_; } |
| 32 | 36 |
| 33 // Start the permission request process. | 37 // Start the permission request process. |
| 34 void RequestPermission(); | 38 void RequestPermission(); |
| 35 | 39 |
| 36 // CookiesPromptViewDelegate methods: | 40 // CookiesPromptViewDelegate methods: |
| 37 virtual void AllowSiteData(bool session_expire); | 41 virtual void AllowSiteData(bool session_expire); |
| 38 virtual void BlockSiteData(); | 42 virtual void BlockSiteData(); |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 void SendResponse(ContentSetting content_setting); | 45 void SendResponse(ContentSetting content_setting); |
| 42 | 46 |
| 43 // The URL to get permission for. | 47 // The URL to get permission for. |
| 44 const GURL url_; | 48 const GURL url_; |
| 45 const string16 database_name_; | 49 const string16 database_name_; |
| 50 const string16 display_name_; |
| 51 unsigned long estimated_size_; |
| 46 | 52 |
| 47 // Set on IO, possibly release()ed on UI, destroyed on IO or UI. | 53 // Set on IO, possibly release()ed on UI, destroyed on IO or UI. |
| 48 scoped_ptr<Task> on_allow_; | 54 scoped_ptr<Task> on_allow_; |
| 49 scoped_ptr<Task> on_block_; | 55 scoped_ptr<Task> on_block_; |
| 50 | 56 |
| 51 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 57 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
| 52 | 58 |
| 53 // Released once we have our answer. | 59 // Released once we have our answer. |
| 54 scoped_refptr<DatabasePermissionRequest> self_ref_; | 60 scoped_refptr<DatabasePermissionRequest> self_ref_; |
| 55 | 61 |
| 56 DISALLOW_IMPLICIT_CONSTRUCTORS(DatabasePermissionRequest); | 62 DISALLOW_IMPLICIT_CONSTRUCTORS(DatabasePermissionRequest); |
| 57 }; | 63 }; |
| 58 | 64 |
| 59 #endif // CHROME_BROWSER_RENDERER_HOST_DATABASE_PERMISSION_REQUEST_H_ | 65 #endif // CHROME_BROWSER_RENDERER_HOST_DATABASE_PERMISSION_REQUEST_H_ |
| OLD | NEW |