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.
5 #include "chrome/browser/media/media_stream_mic_permission_context_factory.h"
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"
12 MediaStreamMicPermissionContextFactory::MediaStreamMicPermissionContextFactory()
13 : PermissionContextFactoryBase(
14 "MediaStreamMicPermissionContext",
15 BrowserContextDependencyManager::GetInstance()) {}
17 MediaStreamMicPermissionContextFactory::
18 ~MediaStreamMicPermissionContextFactory() {}
20 KeyedService
* MediaStreamMicPermissionContextFactory::BuildServiceInstanceFor(
21 content::BrowserContext
* profile
) const {
22 return new MediaStreamDevicePermissionContext(
23 static_cast<Profile
*>(profile
), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC
);
27 MediaStreamMicPermissionContextFactory
*
28 MediaStreamMicPermissionContextFactory::GetInstance() {
29 return base::Singleton
<MediaStreamMicPermissionContextFactory
>::get();
33 MediaStreamDevicePermissionContext
*
34 MediaStreamMicPermissionContextFactory::GetForProfile(Profile
* profile
) {
35 return static_cast<MediaStreamDevicePermissionContext
*>(
36 GetInstance()->GetServiceForBrowserContext(profile
, true));