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

Side by Side Diff: components/keyed_service/ios/refcounted_browser_state_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: Remove wrapper methods 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/ios/refcounted_browser_state_keyed_service_fa ctory.h" 5 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_fa ctory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/keyed_service/core/refcounted_keyed_service.h" 8 #include "components/keyed_service/core/refcounted_keyed_service.h"
9 #include "components/keyed_service/ios/browser_state_context_converter.h"
9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" 10 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
10 #include "components/keyed_service/ios/browser_state_helper.h"
11 #include "ios/web/public/browser_state.h" 11 #include "ios/web/public/browser_state.h"
12 12
13 void RefcountedBrowserStateKeyedServiceFactory::SetTestingFactory( 13 void RefcountedBrowserStateKeyedServiceFactory::SetTestingFactory(
14 web::BrowserState* context, 14 web::BrowserState* context,
15 TestingFactoryFunction testing_factory) { 15 TestingFactoryFunction testing_factory) {
16 RefcountedKeyedServiceFactory::SetTestingFactory( 16 RefcountedKeyedServiceFactory::SetTestingFactory(
17 context, 17 context,
18 reinterpret_cast<RefcountedKeyedServiceFactory::TestingFactoryFunction>( 18 reinterpret_cast<RefcountedKeyedServiceFactory::TestingFactoryFunction>(
19 testing_factory)); 19 testing_factory));
20 } 20 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 void RefcountedBrowserStateKeyedServiceFactory::BrowserStateDestroyed( 81 void RefcountedBrowserStateKeyedServiceFactory::BrowserStateDestroyed(
82 web::BrowserState* context) { 82 web::BrowserState* context) {
83 RefcountedKeyedServiceFactory::ContextDestroyed(context); 83 RefcountedKeyedServiceFactory::ContextDestroyed(context);
84 } 84 }
85 85
86 scoped_refptr<RefcountedKeyedService> 86 scoped_refptr<RefcountedKeyedService>
87 RefcountedBrowserStateKeyedServiceFactory::BuildServiceInstanceFor( 87 RefcountedBrowserStateKeyedServiceFactory::BuildServiceInstanceFor(
88 base::SupportsUserData* context) const { 88 base::SupportsUserData* context) const {
89 return BuildServiceInstanceFor(BrowserStateFromContext(context)); 89 return BuildServiceInstanceFor(static_cast<web::BrowserState*>(context));
90 } 90 }
91 91
92 bool RefcountedBrowserStateKeyedServiceFactory::IsOffTheRecord( 92 bool RefcountedBrowserStateKeyedServiceFactory::IsOffTheRecord(
93 base::SupportsUserData* context) const { 93 base::SupportsUserData* context) const {
94 return BrowserStateFromContext(context)->IsOffTheRecord(); 94 return static_cast<web::BrowserState*>(context)->IsOffTheRecord();
95 } 95 }
96 96
97 user_prefs::PrefRegistrySyncable* 97 #if defined(OS_IOS)
98 RefcountedBrowserStateKeyedServiceFactory::GetAssociatedPrefRegistry( 98 base::SupportsUserData*
99 RefcountedBrowserStateKeyedServiceFactory::GetTypedContext(
99 base::SupportsUserData* context) const { 100 base::SupportsUserData* context) const {
100 NOTREACHED(); 101 if (context) {
101 return nullptr; 102 BrowserStateContextConverter* context_converter =
103 BrowserStateContextConverter::GetInstance();
104 if (context_converter) {
105 context = context_converter->GetBrowserStateForContext(context);
106 DCHECK(context);
107 }
108 }
109 return context;
102 } 110 }
103 111
104 base::SupportsUserData* 112 base::SupportsUserData*
113 RefcountedBrowserStateKeyedServiceFactory::GetContextForDependencyManager(
114 base::SupportsUserData* context) const {
115 if (context) {
116 BrowserStateContextConverter* context_converter =
117 BrowserStateContextConverter::GetInstance();
118 if (context_converter) {
119 context = context_converter->GetBrowserContextForContext(context);
120 DCHECK(context);
121 }
122 }
123 return context;
124 }
125 #endif // defined(OS_IOS)
126
127 base::SupportsUserData*
105 RefcountedBrowserStateKeyedServiceFactory::GetContextToUse( 128 RefcountedBrowserStateKeyedServiceFactory::GetContextToUse(
106 base::SupportsUserData* context) const { 129 base::SupportsUserData* context) const {
107 return GetBrowserStateToUse(BrowserStateFromContext(context)); 130 return GetBrowserStateToUse(static_cast<web::BrowserState*>(context));
108 } 131 }
109 132
110 bool RefcountedBrowserStateKeyedServiceFactory::ServiceIsCreatedWithContext() 133 bool RefcountedBrowserStateKeyedServiceFactory::ServiceIsCreatedWithContext()
111 const { 134 const {
112 return ServiceIsCreatedWithBrowserState(); 135 return ServiceIsCreatedWithBrowserState();
113 } 136 }
114 137
115 void RefcountedBrowserStateKeyedServiceFactory::ContextShutdown( 138 void RefcountedBrowserStateKeyedServiceFactory::ContextShutdown(
116 base::SupportsUserData* context) { 139 base::SupportsUserData* context) {
117 BrowserStateShutdown(BrowserStateFromContext(context)); 140 BrowserStateShutdown(static_cast<web::BrowserState*>(context));
118 } 141 }
119 142
120 void RefcountedBrowserStateKeyedServiceFactory::ContextDestroyed( 143 void RefcountedBrowserStateKeyedServiceFactory::ContextDestroyed(
121 base::SupportsUserData* context) { 144 base::SupportsUserData* context) {
122 BrowserStateDestroyed(BrowserStateFromContext(context)); 145 BrowserStateDestroyed(static_cast<web::BrowserState*>(context));
123 } 146 }
124 147
125 void RefcountedBrowserStateKeyedServiceFactory::RegisterPrefs( 148 void RefcountedBrowserStateKeyedServiceFactory::RegisterPrefs(
126 user_prefs::PrefRegistrySyncable* registry) { 149 user_prefs::PrefRegistrySyncable* registry) {
127 RegisterProfilePrefs(registry); 150 RegisterBrowserStatePrefs(registry);
128 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698