Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / media / protected_media_identifier_permission_context_factory.cc
blobe6ace58f57b16ba989d145aa219a36a4684f98d5
1 // Copyright 2013 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/protected_media_identifier_permission_context_factory.h"
7 #include "chrome/browser/media/protected_media_identifier_permission_context.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/pref_names.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "components/pref_registry/pref_registry_syncable.h"
14 // static
15 ProtectedMediaIdentifierPermissionContext*
16 ProtectedMediaIdentifierPermissionContextFactory::GetForProfile(
17 Profile* profile) {
18 return static_cast<ProtectedMediaIdentifierPermissionContext*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true));
22 // static
23 ProtectedMediaIdentifierPermissionContextFactory*
24 ProtectedMediaIdentifierPermissionContextFactory::GetInstance() {
25 return Singleton<
26 ProtectedMediaIdentifierPermissionContextFactory>::get();
29 ProtectedMediaIdentifierPermissionContextFactory::
30 ProtectedMediaIdentifierPermissionContextFactory()
31 : BrowserContextKeyedServiceFactory(
32 "ProtectedMediaIdentifierPermissionContext",
33 BrowserContextDependencyManager::GetInstance()) {
36 ProtectedMediaIdentifierPermissionContextFactory::
37 ~ProtectedMediaIdentifierPermissionContextFactory() {
40 KeyedService*
41 ProtectedMediaIdentifierPermissionContextFactory::BuildServiceInstanceFor(
42 content::BrowserContext* profile) const {
43 return new ProtectedMediaIdentifierPermissionContext(
44 static_cast<Profile*>(profile));
47 void
48 ProtectedMediaIdentifierPermissionContextFactory::RegisterProfilePrefs(
49 user_prefs::PrefRegistrySyncable* registry) {
50 #if defined(OS_ANDROID)
51 registry->RegisterBooleanPref(prefs::kProtectedMediaIdentifierEnabled, true);
52 #endif
55 content::BrowserContext*
56 ProtectedMediaIdentifierPermissionContextFactory::GetBrowserContextToUse(
57 content::BrowserContext* context) const {
58 return chrome::GetBrowserContextOwnInstanceInIncognito(context);