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_mic_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 |
| 12 MediaStreamMicPermissionContextFactory::MediaStreamMicPermissionContextFactory() |
| 13 : BrowserContextKeyedServiceFactory( |
| 14 "MediaStreamMicPermissionContext", |
| 15 BrowserContextDependencyManager::GetInstance()) {} |
| 16 |
| 17 MediaStreamMicPermissionContextFactory:: |
| 18 ~MediaStreamMicPermissionContextFactory() {} |
| 19 |
| 20 KeyedService* MediaStreamMicPermissionContextFactory::BuildServiceInstanceFor( |
| 21 content::BrowserContext* profile) const { |
| 22 return new MediaStreamDevicePermissionContext( |
| 23 static_cast<Profile*>(profile), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 24 } |
| 25 |
| 26 content::BrowserContext* |
| 27 MediaStreamMicPermissionContextFactory::GetBrowserContextToUse( |
| 28 content::BrowserContext* context) const { |
| 29 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 30 } |
| 31 |
| 32 // static |
| 33 MediaStreamMicPermissionContextFactory* |
| 34 MediaStreamMicPermissionContextFactory::GetInstance() { |
| 35 return Singleton<MediaStreamMicPermissionContextFactory>::get(); |
| 36 } |
| 37 |
| 38 // static |
| 39 MediaStreamDevicePermissionContext* |
| 40 MediaStreamMicPermissionContextFactory::GetForProfile(Profile* profile) { |
| 41 return static_cast<MediaStreamDevicePermissionContext*>( |
| 42 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 43 } |
OLD | NEW |