OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 #include "chrome/browser/ui/bluetooth/bluetooth_permission_context_factory.h" |
| 6 |
| 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/bluetooth/bluetooth_permission_context.h" |
| 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 12 |
| 13 BluetoothPermissionContextFactory::BluetoothPermissionContextFactory() |
| 14 : BrowserContextKeyedServiceFactory( |
| 15 "BluetoothPermissionContext", |
| 16 BrowserContextDependencyManager::GetInstance()) { |
| 17 DependsOn(HostContentSettingsMapFactory::GetInstance()); |
| 18 } |
| 19 |
| 20 BluetoothPermissionContextFactory::~BluetoothPermissionContextFactory() {} |
| 21 |
| 22 KeyedService* BluetoothPermissionContextFactory::BuildServiceInstanceFor( |
| 23 content::BrowserContext* context) const { |
| 24 return new BluetoothPermissionContext(Profile::FromBrowserContext(context)); |
| 25 } |
| 26 |
| 27 // static |
| 28 BluetoothPermissionContextFactory* |
| 29 BluetoothPermissionContextFactory::GetInstance() { |
| 30 return base::Singleton<BluetoothPermissionContextFactory>::get(); |
| 31 } |
| 32 |
| 33 // static |
| 34 BluetoothPermissionContext* BluetoothPermissionContextFactory::GetForProfile( |
| 35 Profile* profile) { |
| 36 return static_cast<BluetoothPermissionContext*>( |
| 37 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 38 } |
| 39 |
| 40 content::BrowserContext* |
| 41 BluetoothPermissionContextFactory::GetBrowserContextToUse( |
| 42 content::BrowserContext* context) const { |
| 43 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 44 } |
OLD | NEW |