Fix build break
[chromium-blink-merge.git] / chrome / browser / plugins / plugin_prefs_factory.cc
blob32b543cf616c4d0c44131787e9710fffaed4acae
1 // Copyright (c) 2012 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/plugins/plugin_prefs_factory.h"
7 #include "base/path_service.h"
8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/plugins/plugin_prefs.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_dependency_manager.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h"
13 #include "chrome/common/chrome_paths.h"
14 #include "chrome/common/pref_names.h"
15 #include "components/user_prefs/pref_registry_syncable.h"
17 // static
18 PluginPrefsFactory* PluginPrefsFactory::GetInstance() {
19 return Singleton<PluginPrefsFactory>::get();
22 // static
23 scoped_refptr<PluginPrefs> PluginPrefsFactory::GetPrefsForProfile(
24 Profile* profile) {
25 return static_cast<PluginPrefs*>(
26 GetInstance()->GetServiceForProfile(profile, true).get());
29 // static
30 scoped_refptr<RefcountedProfileKeyedService>
31 PluginPrefsFactory::CreateForTestingProfile(Profile* profile) {
32 return static_cast<PluginPrefs*>(
33 GetInstance()->BuildServiceInstanceFor(profile).get());
36 PluginPrefsFactory::PluginPrefsFactory()
37 : RefcountedProfileKeyedServiceFactory(
38 "PluginPrefs", ProfileDependencyManager::GetInstance()) {
41 PluginPrefsFactory::~PluginPrefsFactory() {}
43 scoped_refptr<RefcountedProfileKeyedService>
44 PluginPrefsFactory::BuildServiceInstanceFor(Profile* profile) const {
45 scoped_refptr<PluginPrefs> plugin_prefs(new PluginPrefs());
46 plugin_prefs->set_profile(profile->GetOriginalProfile());
47 plugin_prefs->SetPrefs(profile->GetPrefs());
48 return plugin_prefs;
51 void PluginPrefsFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) {
52 base::FilePath internal_dir;
53 PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir);
54 registry->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory,
55 internal_dir,
56 PrefRegistrySyncable::UNSYNCABLE_PREF);
57 registry->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF,
58 false,
59 PrefRegistrySyncable::UNSYNCABLE_PREF);
60 registry->RegisterBooleanPref(prefs::kPluginsEnabledNaCl,
61 false,
62 PrefRegistrySyncable::UNSYNCABLE_PREF);
63 registry->RegisterBooleanPref(prefs::kPluginsMigratedToPepperFlash,
64 false,
65 PrefRegistrySyncable::UNSYNCABLE_PREF);
66 registry->RegisterBooleanPref(
67 prefs::kPluginsRemovedOldComponentPepperFlashSettings,
68 false,
69 PrefRegistrySyncable::UNSYNCABLE_PREF);
70 registry->RegisterListPref(prefs::kPluginsPluginsList,
71 PrefRegistrySyncable::UNSYNCABLE_PREF);
72 registry->RegisterListPref(prefs::kPluginsDisabledPlugins,
73 PrefRegistrySyncable::UNSYNCABLE_PREF);
74 registry->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions,
75 PrefRegistrySyncable::UNSYNCABLE_PREF);
76 registry->RegisterListPref(prefs::kPluginsEnabledPlugins,
77 PrefRegistrySyncable::UNSYNCABLE_PREF);
80 bool PluginPrefsFactory::ServiceRedirectedInIncognito() const {
81 return true;
84 bool PluginPrefsFactory::ServiceIsNULLWhileTesting() const {
85 return true;
88 bool PluginPrefsFactory::ServiceIsCreatedWithProfile() const {
89 return true;