| 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 |
| 18 class PermissionQueueController; | 22 class PermissionQueueController; |
| 19 class PermissionRequestID; | 23 class PermissionRequestID; |
| 20 class Profile; | 24 class Profile; |
| 21 | 25 |
| 22 namespace content { | 26 namespace content { |
| 23 class WebContents; | 27 class WebContents; |
| 24 } | 28 } |
| 25 | 29 |
| 26 typedef base::Callback<void(bool)> BrowserPermissionCallback; | 30 typedef base::Callback<void(bool)> BrowserPermissionCallback; |
| 27 | 31 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // virtual since the permission might be stored with different restrictions | 120 // virtual since the permission might be stored with different restrictions |
| 117 // (for example for desktop notifications). | 121 // (for example for desktop notifications). |
| 118 virtual void UpdateContentSetting(const GURL& requesting_origin, | 122 virtual void UpdateContentSetting(const GURL& requesting_origin, |
| 119 const GURL& embedding_origin, | 123 const GURL& embedding_origin, |
| 120 bool allowed); | 124 bool allowed); |
| 121 | 125 |
| 122 private: | 126 private: |
| 123 // 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. |
| 124 void CleanUpBubble(const PermissionRequestID& id); | 128 void CleanUpBubble(const PermissionRequestID& id); |
| 125 | 129 |
| 130 #if defined(OS_CHROMEOS) |
| 131 typedef base::Callback<void(bool /* persist */, bool /* allowed */)> |
| 132 PermissionCallback; |
| 133 void OnPlatformVerificationResult( |
| 134 const PermissionCallback& permission_callback, |
| 135 chromeos::attestation::PlatformVerificationFlow::ConsentResponse |
| 136 response); |
| 137 #endif |
| 138 |
| 126 Profile* profile_; | 139 Profile* profile_; |
| 127 const ContentSettingsType permission_type_; | 140 const ContentSettingsType permission_type_; |
| 128 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 141 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
| 129 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> | 142 base::ScopedPtrHashMap<std::string, PermissionBubbleRequest> |
| 130 pending_bubbles_; | 143 pending_bubbles_; |
| 131 | 144 |
| 132 // Must be the last member, to ensure that it will be | 145 // Must be the last member, to ensure that it will be |
| 133 // destroyed first, which will invalidate weak pointers | 146 // destroyed first, which will invalidate weak pointers |
| 134 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 147 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
| 135 }; | 148 }; |
| 136 | 149 |
| 137 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ | 150 #endif // CHROME_BROWSER_CONTENT_SETTINGS_PERMISSION_CONTEXT_BASE_H_ |
| OLD | NEW |