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