Index: chrome/browser/media/media_stream_camera_permission_context_factory.cc |
diff --git a/chrome/browser/media/media_stream_camera_permission_context_factory.cc b/chrome/browser/media/media_stream_camera_permission_context_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..af93919b51a7a531fc5a3ed1a1718beed5db08fb |
--- /dev/null |
+++ b/chrome/browser/media/media_stream_camera_permission_context_factory.cc |
@@ -0,0 +1,45 @@ |
+// 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/media/media_stream_camera_permission_context_factory.h" |
+ |
+#include "chrome/browser/media/media_stream_device_permission_context.h" |
+#include "chrome/browser/profiles/incognito_helpers.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+ |
+MediaStreamCameraPermissionContextFactory:: |
+ MediaStreamCameraPermissionContextFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "MediaStreamCameraPermissionContext", |
+ BrowserContextDependencyManager::GetInstance()) {} |
+ |
+MediaStreamCameraPermissionContextFactory:: |
+ ~MediaStreamCameraPermissionContextFactory() {} |
+ |
+KeyedService* |
+MediaStreamCameraPermissionContextFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* profile) const { |
+ return new MediaStreamDevicePermissionContext( |
+ static_cast<Profile*>(profile), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
+} |
+ |
+content::BrowserContext* |
+MediaStreamCameraPermissionContextFactory::GetBrowserContextToUse( |
+ content::BrowserContext* context) const { |
+ return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
+} |
+ |
+// static |
+MediaStreamCameraPermissionContextFactory* |
+MediaStreamCameraPermissionContextFactory::GetInstance() { |
+ return Singleton<MediaStreamCameraPermissionContextFactory>::get(); |
+} |
+ |
+// static |
+MediaStreamDevicePermissionContext* |
+MediaStreamCameraPermissionContextFactory::GetForProfile(Profile* profile) { |
+ return static_cast<MediaStreamDevicePermissionContext*>( |
+ GetInstance()->GetServiceForBrowserContext(profile, true)); |
+} |