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

Side by Side Diff: chrome/browser/background/background_contents_service_factory.cc

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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/background/background_contents_service_factory.h" 5 #include "chrome/browser/background/background_contents_service_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/background/background_contents_service.h" 9 #include "chrome/browser/background/background_contents_service.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 13 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
14 #include "components/user_prefs/pref_registry_syncable.h" 14 #include "components/user_prefs/pref_registry_syncable.h"
15 15
16 // static 16 // static
17 BackgroundContentsService* BackgroundContentsServiceFactory::GetForProfile( 17 BackgroundContentsService* BackgroundContentsServiceFactory::GetForProfile(
18 Profile* profile) { 18 Profile* profile) {
19 return static_cast<BackgroundContentsService*>( 19 return static_cast<BackgroundContentsService*>(
20 GetInstance()->GetServiceForProfile(profile, true)); 20 GetInstance()->GetServiceForBrowserContext(profile, true));
21 } 21 }
22 22
23 // static 23 // static
24 BackgroundContentsServiceFactory* BackgroundContentsServiceFactory:: 24 BackgroundContentsServiceFactory* BackgroundContentsServiceFactory::
25 GetInstance() { 25 GetInstance() {
26 return Singleton<BackgroundContentsServiceFactory>::get(); 26 return Singleton<BackgroundContentsServiceFactory>::get();
27 } 27 }
28 28
29 BackgroundContentsServiceFactory::BackgroundContentsServiceFactory() 29 BackgroundContentsServiceFactory::BackgroundContentsServiceFactory()
30 : ProfileKeyedServiceFactory("BackgroundContentsService", 30 : BrowserContextKeyedServiceFactory(
31 ProfileDependencyManager::GetInstance()) { 31 "BackgroundContentsService",
32 BrowserContextDependencyManager::GetInstance()) {
32 } 33 }
33 34
34 BackgroundContentsServiceFactory::~BackgroundContentsServiceFactory() { 35 BackgroundContentsServiceFactory::~BackgroundContentsServiceFactory() {
35 } 36 }
36 37
37 ProfileKeyedService* BackgroundContentsServiceFactory::BuildServiceInstanceFor( 38 BrowserContextKeyedService*
39 BackgroundContentsServiceFactory::BuildServiceInstanceFor(
38 content::BrowserContext* profile) const { 40 content::BrowserContext* profile) const {
39 return new BackgroundContentsService(static_cast<Profile*>(profile), 41 return new BackgroundContentsService(static_cast<Profile*>(profile),
40 CommandLine::ForCurrentProcess()); 42 CommandLine::ForCurrentProcess());
41 } 43 }
42 44
43 void BackgroundContentsServiceFactory::RegisterUserPrefs( 45 void BackgroundContentsServiceFactory::RegisterUserPrefs(
44 user_prefs::PrefRegistrySyncable* user_prefs) { 46 user_prefs::PrefRegistrySyncable* user_prefs) {
45 user_prefs->RegisterDictionaryPref( 47 user_prefs->RegisterDictionaryPref(
46 prefs::kRegisteredBackgroundContents, 48 prefs::kRegisteredBackgroundContents,
47 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 49 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
48 } 50 }
49 51
50 content::BrowserContext* 52 content::BrowserContext*
51 BackgroundContentsServiceFactory::GetBrowserContextToUse( 53 BackgroundContentsServiceFactory::GetBrowserContextToUse(
52 content::BrowserContext* context) const { 54 content::BrowserContext* context) const {
53 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 55 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
54 } 56 }
55 57
56 bool BackgroundContentsServiceFactory::ServiceIsCreatedWithProfile() const { 58 bool
59 BackgroundContentsServiceFactory::ServiceIsCreatedWithBrowserContext() const {
57 return true; 60 return true;
58 } 61 }
59 62
60 bool BackgroundContentsServiceFactory::ServiceIsNULLWhileTesting() const { 63 bool BackgroundContentsServiceFactory::ServiceIsNULLWhileTesting() const {
61 return true; 64 return true;
62 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698