| 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_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/containers/scoped_ptr_hash_map.h" | 11 #include "base/containers/scoped_ptr_hash_map.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/browser/permissions/permission_request.h" | 14 #include "chrome/browser/permissions/permission_request.h" |
| 15 #include "components/content_settings/core/common/content_settings.h" | 15 #include "components/content_settings/core/common/content_settings.h" |
| 16 #include "components/content_settings/core/common/content_settings_types.h" | 16 #include "components/content_settings/core/common/content_settings_types.h" |
| 17 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
| 18 #include "content/public/browser/permission_type.h" | 18 #include "content/public/browser/permission_type.h" |
| 19 | 19 |
| 20 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
| 21 class PermissionQueueController; | 21 class PermissionQueueController; |
| 22 #endif | 22 #endif |
| 23 class GURL; | 23 class GURL; |
| 24 class PermissionDecisionAutoBlocker; | |
| 25 class PermissionRequestID; | 24 class PermissionRequestID; |
| 26 class Profile; | 25 class Profile; |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 class WebContents; | 28 class WebContents; |
| 30 } | 29 } |
| 31 | 30 |
| 32 using BrowserPermissionCallback = base::Callback<void(ContentSetting)>; | 31 using BrowserPermissionCallback = base::Callback<void(ContentSetting)>; |
| 33 | 32 |
| 34 // This base class contains common operations for granting permissions. | 33 // This base class contains common operations for granting permissions. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return content_settings_type_; | 155 return content_settings_type_; |
| 157 } | 156 } |
| 158 | 157 |
| 159 private: | 158 private: |
| 160 friend class PermissionContextBaseTests; | 159 friend class PermissionContextBaseTests; |
| 161 | 160 |
| 162 // Called when a request is no longer used so it can be cleaned up. | 161 // Called when a request is no longer used so it can be cleaned up. |
| 163 void CleanUpRequest(const PermissionRequestID& id); | 162 void CleanUpRequest(const PermissionRequestID& id); |
| 164 | 163 |
| 165 Profile* profile_; | 164 Profile* profile_; |
| 166 std::unique_ptr<PermissionDecisionAutoBlocker> decision_auto_blocker_; | |
| 167 const content::PermissionType permission_type_; | 165 const content::PermissionType permission_type_; |
| 168 const ContentSettingsType content_settings_type_; | 166 const ContentSettingsType content_settings_type_; |
| 169 #if defined(OS_ANDROID) | 167 #if defined(OS_ANDROID) |
| 170 std::unique_ptr<PermissionQueueController> permission_queue_controller_; | 168 std::unique_ptr<PermissionQueueController> permission_queue_controller_; |
| 171 #endif | 169 #endif |
| 172 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>> | 170 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>> |
| 173 pending_requests_; | 171 pending_requests_; |
| 174 | 172 |
| 175 // Must be the last member, to ensure that it will be | 173 // Must be the last member, to ensure that it will be |
| 176 // destroyed first, which will invalidate weak pointers | 174 // destroyed first, which will invalidate weak pointers |
| 177 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 175 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
| 178 }; | 176 }; |
| 179 | 177 |
| 180 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 178 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
| OLD | NEW |