| 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/media/media_stream_camera_permission_context_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/media/media_stream_device_permission_context.h" | |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" | |
| 9 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 11 #include "content/public/browser/permission_type.h" | |
| 12 | |
| 13 MediaStreamCameraPermissionContextFactory:: | |
| 14 MediaStreamCameraPermissionContextFactory() | |
| 15 : PermissionContextFactoryBase( | |
| 16 "MediaStreamCameraPermissionContext", | |
| 17 BrowserContextDependencyManager::GetInstance()) {} | |
| 18 | |
| 19 MediaStreamCameraPermissionContextFactory:: | |
| 20 ~MediaStreamCameraPermissionContextFactory() {} | |
| 21 | |
| 22 KeyedService* | |
| 23 MediaStreamCameraPermissionContextFactory::BuildServiceInstanceFor( | |
| 24 content::BrowserContext* profile) const { | |
| 25 return new MediaStreamDevicePermissionContext( | |
| 26 static_cast<Profile*>(profile), content::PermissionType::VIDEO_CAPTURE, | |
| 27 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | |
| 28 } | |
| 29 | |
| 30 // static | |
| 31 MediaStreamCameraPermissionContextFactory* | |
| 32 MediaStreamCameraPermissionContextFactory::GetInstance() { | |
| 33 return base::Singleton<MediaStreamCameraPermissionContextFactory>::get(); | |
| 34 } | |
| 35 | |
| 36 // static | |
| 37 MediaStreamDevicePermissionContext* | |
| 38 MediaStreamCameraPermissionContextFactory::GetForProfile(Profile* profile) { | |
| 39 return static_cast<MediaStreamDevicePermissionContext*>( | |
| 40 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 41 } | |
| OLD | NEW |