Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / media / media_stream_mic_permission_context_factory.cc
blobc59d6f0fa333a2f23b67fb0cd58b378abca472e9
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 : BrowserContextKeyedServiceFactory(
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);
26 content::BrowserContext*
27 MediaStreamMicPermissionContextFactory::GetBrowserContextToUse(
28 content::BrowserContext* context) const {
29 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
32 // static
33 MediaStreamMicPermissionContextFactory*
34 MediaStreamMicPermissionContextFactory::GetInstance() {
35 return Singleton<MediaStreamMicPermissionContextFactory>::get();
38 // static
39 MediaStreamDevicePermissionContext*
40 MediaStreamMicPermissionContextFactory::GetForProfile(Profile* profile) {
41 return static_cast<MediaStreamDevicePermissionContext*>(
42 GetInstance()->GetServiceForBrowserContext(profile, true));