| 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.h" | 10 #include "base/callback.h" |
| 11 #include "base/containers/scoped_ptr_hash_map.h" | 11 #include "base/containers/scoped_ptr_hash_map.h" |
| 12 #include "base/lazy_instance.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/permissions/permission_prompt_decision_log.h" |
| 15 #include "chrome/browser/permissions/permission_request.h" | 17 #include "chrome/browser/permissions/permission_request.h" |
| 16 #include "components/content_settings/core/common/content_settings.h" | 18 #include "components/content_settings/core/common/content_settings.h" |
| 17 #include "components/content_settings/core/common/content_settings_types.h" | 19 #include "components/content_settings/core/common/content_settings_types.h" |
| 18 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
| 19 #include "content/public/browser/permission_type.h" | 21 #include "content/public/browser/permission_type.h" |
| 20 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 21 | 23 |
| 22 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 23 class PermissionQueueController; | 25 class PermissionQueueController; |
| 24 #endif | 26 #endif |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 160 |
| 159 private: | 161 private: |
| 160 // Called when a request is no longer used so it can be cleaned up. | 162 // Called when a request is no longer used so it can be cleaned up. |
| 161 void CleanUpRequest(const PermissionRequestID& id); | 163 void CleanUpRequest(const PermissionRequestID& id); |
| 162 | 164 |
| 163 Profile* profile_; | 165 Profile* profile_; |
| 164 const content::PermissionType permission_type_; | 166 const content::PermissionType permission_type_; |
| 165 const ContentSettingsType content_settings_type_; | 167 const ContentSettingsType content_settings_type_; |
| 166 #if defined(OS_ANDROID) | 168 #if defined(OS_ANDROID) |
| 167 std::unique_ptr<PermissionQueueController> permission_queue_controller_; | 169 std::unique_ptr<PermissionQueueController> permission_queue_controller_; |
| 170 #else |
| 171 base::LazyInstance<PermissionPromptDecisionLog> prompt_decision_log_ = |
| 172 LAZY_INSTANCE_INITIALIZER; |
| 168 #endif | 173 #endif |
| 169 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>> | 174 base::ScopedPtrHashMap<std::string, std::unique_ptr<PermissionRequest>> |
| 170 pending_requests_; | 175 pending_requests_; |
| 171 | 176 |
| 172 // Must be the last member, to ensure that it will be | 177 // Must be the last member, to ensure that it will be |
| 173 // destroyed first, which will invalidate weak pointers | 178 // destroyed first, which will invalidate weak pointers |
| 174 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 179 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
| 175 }; | 180 }; |
| 176 | 181 |
| 177 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 182 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
| OLD | NEW |