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

Side by Side Diff: components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc

Issue 1090373003: Allow cross dependencies between BCKSF and BSKSF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix dependencies and DCHECK in Get{Original,Underlying}ContextInternal Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/keyed_service/content/refcounted_browser_context_keyed_serv ice_factory.h" 5 #include "components/keyed_service/content/refcounted_browser_context_keyed_serv ice_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h" 8 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "components/keyed_service/core/refcounted_keyed_service.h" 9 #include "components/keyed_service/core/refcounted_keyed_service.h"
11 #include "components/pref_registry/pref_registry_syncable.h"
12 #include "components/user_prefs/user_prefs.h"
13 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
14 11
15 void RefcountedBrowserContextKeyedServiceFactory::SetTestingFactory( 12 void RefcountedBrowserContextKeyedServiceFactory::SetTestingFactory(
16 content::BrowserContext* context, 13 content::BrowserContext* context,
17 TestingFactoryFunction testing_factory) { 14 TestingFactoryFunction testing_factory) {
18 RefcountedKeyedServiceFactory::SetTestingFactory( 15 RefcountedKeyedServiceFactory::SetTestingFactory(
19 context, 16 context,
20 reinterpret_cast<RefcountedKeyedServiceFactory::TestingFactoryFunction>( 17 reinterpret_cast<RefcountedKeyedServiceFactory::TestingFactoryFunction>(
21 testing_factory)); 18 testing_factory));
22 } 19 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 base::SupportsUserData* context) const { 92 base::SupportsUserData* context) const {
96 return BuildServiceInstanceFor( 93 return BuildServiceInstanceFor(
97 static_cast<content::BrowserContext*>(context)); 94 static_cast<content::BrowserContext*>(context));
98 } 95 }
99 96
100 bool RefcountedBrowserContextKeyedServiceFactory::IsOffTheRecord( 97 bool RefcountedBrowserContextKeyedServiceFactory::IsOffTheRecord(
101 base::SupportsUserData* context) const { 98 base::SupportsUserData* context) const {
102 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord(); 99 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord();
103 } 100 }
104 101
105 user_prefs::PrefRegistrySyncable* 102 base::SupportsUserData*
106 RefcountedBrowserContextKeyedServiceFactory::GetAssociatedPrefRegistry( 103 RefcountedBrowserContextKeyedServiceFactory::GetUnderlyingContextInternal(
107 base::SupportsUserData* context) const { 104 base::SupportsUserData* context) const {
108 PrefService* prefs = user_prefs::UserPrefs::Get(context); 105 return context;
109 user_prefs::PrefRegistrySyncable* registry =
110 static_cast<user_prefs::PrefRegistrySyncable*>(
111 prefs->DeprecatedGetPrefRegistry());
112 return registry;
113 } 106 }
114 107
115 base::SupportsUserData* 108 base::SupportsUserData*
109 RefcountedBrowserContextKeyedServiceFactory::GetOriginalContextInternal(
110 base::SupportsUserData* context) const {
111 return context;
112 }
113
114 base::SupportsUserData*
116 RefcountedBrowserContextKeyedServiceFactory::GetContextToUse( 115 RefcountedBrowserContextKeyedServiceFactory::GetContextToUse(
117 base::SupportsUserData* context) const { 116 base::SupportsUserData* context) const {
118 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context)); 117 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context));
119 } 118 }
120 119
121 bool RefcountedBrowserContextKeyedServiceFactory::ServiceIsCreatedWithContext() 120 bool RefcountedBrowserContextKeyedServiceFactory::ServiceIsCreatedWithContext()
122 const { 121 const {
123 return ServiceIsCreatedWithBrowserContext(); 122 return ServiceIsCreatedWithBrowserContext();
124 } 123 }
125 124
126 void RefcountedBrowserContextKeyedServiceFactory::ContextShutdown( 125 void RefcountedBrowserContextKeyedServiceFactory::ContextShutdown(
127 base::SupportsUserData* context) { 126 base::SupportsUserData* context) {
128 BrowserContextShutdown(static_cast<content::BrowserContext*>(context)); 127 BrowserContextShutdown(static_cast<content::BrowserContext*>(context));
129 } 128 }
130 129
131 void RefcountedBrowserContextKeyedServiceFactory::ContextDestroyed( 130 void RefcountedBrowserContextKeyedServiceFactory::ContextDestroyed(
132 base::SupportsUserData* context) { 131 base::SupportsUserData* context) {
133 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context)); 132 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context));
134 } 133 }
135 134
136 void RefcountedBrowserContextKeyedServiceFactory::RegisterPrefs( 135 void RefcountedBrowserContextKeyedServiceFactory::RegisterPrefs(
137 user_prefs::PrefRegistrySyncable* registry) { 136 user_prefs::PrefRegistrySyncable* registry) {
138 RegisterProfilePrefs(registry); 137 RegisterProfilePrefs(registry);
139 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698