Index: chrome/browser/bluetooth/bluetooth_permission_context_factory.cc |
diff --git a/chrome/browser/bluetooth/bluetooth_permission_context_factory.cc b/chrome/browser/bluetooth/bluetooth_permission_context_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..185e5cf3a276fe91b279fd4d6891dc15b7167ca4 |
--- /dev/null |
+++ b/chrome/browser/bluetooth/bluetooth_permission_context_factory.cc |
@@ -0,0 +1,44 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/bluetooth/bluetooth_permission_context_factory.h" |
+ |
+#include "chrome/browser/bluetooth/bluetooth_permission_context.h" |
+#include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
+#include "chrome/browser/profiles/incognito_helpers.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+ |
+BluetoothPermissionContextFactory::BluetoothPermissionContextFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "BluetoothPermissionContext", |
+ BrowserContextDependencyManager::GetInstance()) { |
+ DependsOn(HostContentSettingsMapFactory::GetInstance()); |
+} |
+ |
+BluetoothPermissionContextFactory::~BluetoothPermissionContextFactory() {} |
+ |
+KeyedService* BluetoothPermissionContextFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* context) const { |
+ return new BluetoothPermissionContext(Profile::FromBrowserContext(context)); |
+} |
+ |
+// static |
+BluetoothPermissionContextFactory* |
+BluetoothPermissionContextFactory::GetInstance() { |
+ return base::Singleton<BluetoothPermissionContextFactory>::get(); |
+} |
+ |
+// static |
+BluetoothPermissionContext* BluetoothPermissionContextFactory::GetForProfile( |
+ Profile* profile) { |
+ return static_cast<BluetoothPermissionContext*>( |
+ GetInstance()->GetServiceForBrowserContext(profile, true)); |
+} |
+ |
+content::BrowserContext* |
+BluetoothPermissionContextFactory::GetBrowserContextToUse( |
+ content::BrowserContext* context) const { |
+ return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
+} |