| 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 #include "content/public/browser/permission_type.h" | |
| 12 | |
| 13 MediaStreamMicPermissionContextFactory::MediaStreamMicPermissionContextFactory() | |
| 14 : PermissionContextFactoryBase( | |
| 15 "MediaStreamMicPermissionContext", | |
| 16 BrowserContextDependencyManager::GetInstance()) {} | |
| 17 | |
| 18 MediaStreamMicPermissionContextFactory:: | |
| 19 ~MediaStreamMicPermissionContextFactory() {} | |
| 20 | |
| 21 KeyedService* MediaStreamMicPermissionContextFactory::BuildServiceInstanceFor( | |
| 22 content::BrowserContext* profile) const { | |
| 23 return new MediaStreamDevicePermissionContext( | |
| 24 static_cast<Profile*>(profile), content::PermissionType::AUDIO_CAPTURE, | |
| 25 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | |
| 26 } | |
| 27 | |
| 28 // static | |
| 29 MediaStreamMicPermissionContextFactory* | |
| 30 MediaStreamMicPermissionContextFactory::GetInstance() { | |
| 31 return base::Singleton<MediaStreamMicPermissionContextFactory>::get(); | |
| 32 } | |
| 33 | |
| 34 // static | |
| 35 MediaStreamDevicePermissionContext* | |
| 36 MediaStreamMicPermissionContextFactory::GetForProfile(Profile* profile) { | |
| 37 return static_cast<MediaStreamDevicePermissionContext*>( | |
| 38 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 39 } | |
| OLD | NEW |