Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/plugins/plugin_prefs_factory.cc

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for review Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/plugins/plugin_prefs_factory.h" 5 #include "chrome/browser/plugins/plugin_prefs_factory.h"
6 6
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/plugins/plugin_prefs.h" 9 #include "chrome/browser/plugins/plugin_prefs.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 10 matching lines...) Expand all
21 21
22 // static 22 // static
23 scoped_refptr<PluginPrefs> PluginPrefsFactory::GetPrefsForProfile( 23 scoped_refptr<PluginPrefs> PluginPrefsFactory::GetPrefsForProfile(
24 Profile* profile) { 24 Profile* profile) {
25 return static_cast<PluginPrefs*>( 25 return static_cast<PluginPrefs*>(
26 GetInstance()->GetServiceForProfile(profile, true).get()); 26 GetInstance()->GetServiceForProfile(profile, true).get());
27 } 27 }
28 28
29 // static 29 // static
30 scoped_refptr<RefcountedProfileKeyedService> 30 scoped_refptr<RefcountedProfileKeyedService>
31 PluginPrefsFactory::CreateForTestingProfile(Profile* profile) { 31 PluginPrefsFactory::CreateForTestingProfile(content::BrowserContext* profile) {
32 return static_cast<PluginPrefs*>( 32 return static_cast<PluginPrefs*>(
33 GetInstance()->BuildServiceInstanceFor(profile).get()); 33 GetInstance()->BuildServiceInstanceFor(profile).get());
34 } 34 }
35 35
36 PluginPrefsFactory::PluginPrefsFactory() 36 PluginPrefsFactory::PluginPrefsFactory()
37 : RefcountedProfileKeyedServiceFactory( 37 : RefcountedProfileKeyedServiceFactory(
38 "PluginPrefs", ProfileDependencyManager::GetInstance()) { 38 "PluginPrefs", ProfileDependencyManager::GetInstance()) {
39 } 39 }
40 40
41 PluginPrefsFactory::~PluginPrefsFactory() {} 41 PluginPrefsFactory::~PluginPrefsFactory() {}
42 42
43 scoped_refptr<RefcountedProfileKeyedService> 43 scoped_refptr<RefcountedProfileKeyedService>
44 PluginPrefsFactory::BuildServiceInstanceFor(Profile* profile) const { 44 PluginPrefsFactory::BuildServiceInstanceFor(
45 content::BrowserContext* context) const {
46 Profile* profile = static_cast<Profile*>(context);
45 scoped_refptr<PluginPrefs> plugin_prefs(new PluginPrefs()); 47 scoped_refptr<PluginPrefs> plugin_prefs(new PluginPrefs());
46 plugin_prefs->set_profile(profile->GetOriginalProfile()); 48 plugin_prefs->set_profile(profile->GetOriginalProfile());
47 plugin_prefs->SetPrefs(profile->GetPrefs()); 49 plugin_prefs->SetPrefs(profile->GetPrefs());
48 return plugin_prefs; 50 return plugin_prefs;
49 } 51 }
50 52
51 void PluginPrefsFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { 53 void PluginPrefsFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) {
52 base::FilePath internal_dir; 54 base::FilePath internal_dir;
53 PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir); 55 PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir);
54 registry->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory, 56 registry->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory,
(...skipping 26 matching lines...) Expand all
81 return true; 83 return true;
82 } 84 }
83 85
84 bool PluginPrefsFactory::ServiceIsNULLWhileTesting() const { 86 bool PluginPrefsFactory::ServiceIsNULLWhileTesting() const {
85 return true; 87 return true;
86 } 88 }
87 89
88 bool PluginPrefsFactory::ServiceIsCreatedWithProfile() const { 90 bool PluginPrefsFactory::ServiceIsCreatedWithProfile() const {
89 return true; 91 return true;
90 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698