OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 12 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
13 #include "components/content_settings/core/common/content_settings.h" | 13 #include "components/content_settings/core/common/content_settings.h" |
14 #include "components/content_settings/core/common/content_settings_types.h" | 14 #include "components/content_settings/core/common/content_settings_types.h" |
15 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 #if defined(OS_CHROMEOS) | |
19 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" | |
20 #endif | |
21 | |
22 class PermissionQueueController; | 18 class PermissionQueueController; |
23 class PermissionRequestID; | 19 class PermissionRequestID; |
24 class Profile; | 20 class Profile; |
25 | 21 |
26 namespace content { | 22 namespace content { |
27 class WebContents; | 23 class WebContents; |
28 } | 24 } |
29 | 25 |
30 typedef base::Callback<void(bool)> BrowserPermissionCallback; | 26 typedef base::Callback<void(bool)> BrowserPermissionCallback; |
31 | 27 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // virtual since the permission might be stored with different restrictions | 120 // virtual since the permission might be stored with different restrictions |
125 // (for example for desktop notifications). | 121 // (for example for desktop notifications). |
126 virtual void UpdateContentSetting(const GURL& requesting_origin, | 122 virtual void UpdateContentSetting(const GURL& requesting_origin, |
127 const GURL& embedding_origin, | 123 const GURL& embedding_origin, |
128 bool allowed); | 124 bool allowed); |
129 | 125 |
130 private: | 126 private: |
131 // Called when a bubble is no longer used so it can be cleaned up. | 127 // Called when a bubble is no longer used so it can be cleaned up. |
132 void CleanUpBubble(const PermissionRequestID& id); | 128 void CleanUpBubble(const PermissionRequestID& id); |
133 | 129 |
134 #if defined(OS_CHROMEOS) | |
135 void OnPlatformVerificationResult( | |
136 const PermissionRequestID& id, | |
137 const GURL& requesting_origin, | |
138 const GURL& embedding_origin, | |
139 const BrowserPermissionCallback& callback, | |
140 chromeos::attestation::PlatformVerificationFlow::ConsentResponse | |
141 response); | |
142 #endif | |
143 | |
144 Profile* profile_; | 130 Profile* profile_; |
145 const ContentSettingsType permission_type_; | 131 const ContentSettingsType permission_type_; |
146 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 132 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
147 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> | 133 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> |
148 pending_bubbles_; | 134 pending_bubbles_; |
149 | 135 |
150 // Must be the last member, to ensure that it will be | 136 // Must be the last member, to ensure that it will be |
151 // destroyed first, which will invalidate weak pointers | 137 // destroyed first, which will invalidate weak pointers |
152 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 138 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
153 }; | 139 }; |
154 | 140 |
155 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 141 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
OLD | NEW |