Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / media / media_stream_camera_permission_context_factory.cc
bloba5afebe31d32e9c622a556f7f7e370b754979afa
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_camera_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 MediaStreamCameraPermissionContextFactory::
13 MediaStreamCameraPermissionContextFactory()
14 : BrowserContextKeyedServiceFactory(
15 "MediaStreamCameraPermissionContext",
16 BrowserContextDependencyManager::GetInstance()) {}
18 MediaStreamCameraPermissionContextFactory::
19 ~MediaStreamCameraPermissionContextFactory() {}
21 KeyedService*
22 MediaStreamCameraPermissionContextFactory::BuildServiceInstanceFor(
23 content::BrowserContext* profile) const {
24 return new MediaStreamDevicePermissionContext(
25 static_cast<Profile*>(profile), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
28 content::BrowserContext*
29 MediaStreamCameraPermissionContextFactory::GetBrowserContextToUse(
30 content::BrowserContext* context) const {
31 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
34 // static
35 MediaStreamCameraPermissionContextFactory*
36 MediaStreamCameraPermissionContextFactory::GetInstance() {
37 return base::Singleton<MediaStreamCameraPermissionContextFactory>::get();
40 // static
41 MediaStreamDevicePermissionContext*
42 MediaStreamCameraPermissionContextFactory::GetForProfile(Profile* profile) {
43 return static_cast<MediaStreamDevicePermissionContext*>(
44 GetInstance()->GetServiceForBrowserContext(profile, true));