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