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

Side by Side Diff: components/keyed_service/ios/browser_state_keyed_service_factory.cc

Issue 1062083003: Implement BrowserStateKeyedServiceFactory::GetAssociatedPrefRegistry() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing include in card_unmask_prompt_controller_impl_unittest.cc 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/browser_state_keyed_service_factory.h" 5 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h"
8 #include "components/keyed_service/core/keyed_service.h" 9 #include "components/keyed_service/core/keyed_service.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 "components/keyed_service/ios/browser_state_helper.h"
12 #include "components/pref_registry/pref_registry_syncable.h"
13 #include "components/user_prefs/user_prefs.h"
11 #include "ios/web/public/browser_state.h" 14 #include "ios/web/public/browser_state.h"
12 15
13 void BrowserStateKeyedServiceFactory::SetTestingFactory( 16 void BrowserStateKeyedServiceFactory::SetTestingFactory(
14 web::BrowserState* context, 17 web::BrowserState* context,
15 TestingFactoryFunction testing_factory) { 18 TestingFactoryFunction testing_factory) {
16 KeyedServiceFactory::SetTestingFactory( 19 KeyedServiceFactory::SetTestingFactory(
17 context, reinterpret_cast<KeyedServiceFactory::TestingFactoryFunction>( 20 context, reinterpret_cast<KeyedServiceFactory::TestingFactoryFunction>(
18 testing_factory)); 21 testing_factory));
19 } 22 }
20 23
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 83 }
81 84
82 bool BrowserStateKeyedServiceFactory::IsOffTheRecord( 85 bool BrowserStateKeyedServiceFactory::IsOffTheRecord(
83 base::SupportsUserData* context) const { 86 base::SupportsUserData* context) const {
84 return BrowserStateFromContext(context)->IsOffTheRecord(); 87 return BrowserStateFromContext(context)->IsOffTheRecord();
85 } 88 }
86 89
87 user_prefs::PrefRegistrySyncable* 90 user_prefs::PrefRegistrySyncable*
88 BrowserStateKeyedServiceFactory::GetAssociatedPrefRegistry( 91 BrowserStateKeyedServiceFactory::GetAssociatedPrefRegistry(
89 base::SupportsUserData* context) const { 92 base::SupportsUserData* context) const {
90 NOTREACHED(); 93 // TODO(droger): Move this code to KeyedServiceFactory and share it with the
91 return nullptr; 94 // other platforms once iOS no longer needs BrowserStateFromContext().
95 PrefService* prefs =
96 user_prefs::UserPrefs::Get(BrowserStateFromContext(context));
97 user_prefs::PrefRegistrySyncable* registry =
98 static_cast<user_prefs::PrefRegistrySyncable*>(
99 prefs->DeprecatedGetPrefRegistry());
100 return registry;
92 } 101 }
93 102
94 base::SupportsUserData* BrowserStateKeyedServiceFactory::GetContextToUse( 103 base::SupportsUserData* BrowserStateKeyedServiceFactory::GetContextToUse(
95 base::SupportsUserData* context) const { 104 base::SupportsUserData* context) const {
96 return GetBrowserStateToUse(BrowserStateFromContext(context)); 105 return GetBrowserStateToUse(BrowserStateFromContext(context));
97 } 106 }
98 107
99 bool BrowserStateKeyedServiceFactory::ServiceIsCreatedWithContext() const { 108 bool BrowserStateKeyedServiceFactory::ServiceIsCreatedWithContext() const {
100 return ServiceIsCreatedWithBrowserState(); 109 return ServiceIsCreatedWithBrowserState();
101 } 110 }
102 111
103 void BrowserStateKeyedServiceFactory::ContextShutdown( 112 void BrowserStateKeyedServiceFactory::ContextShutdown(
104 base::SupportsUserData* context) { 113 base::SupportsUserData* context) {
105 BrowserStateShutdown(BrowserStateFromContext(context)); 114 BrowserStateShutdown(BrowserStateFromContext(context));
106 } 115 }
107 116
108 void BrowserStateKeyedServiceFactory::ContextDestroyed( 117 void BrowserStateKeyedServiceFactory::ContextDestroyed(
109 base::SupportsUserData* context) { 118 base::SupportsUserData* context) {
110 BrowserStateDestroyed(BrowserStateFromContext(context)); 119 BrowserStateDestroyed(BrowserStateFromContext(context));
111 } 120 }
112 121
113 void BrowserStateKeyedServiceFactory::RegisterPrefs( 122 void BrowserStateKeyedServiceFactory::RegisterPrefs(
114 user_prefs::PrefRegistrySyncable* registry) { 123 user_prefs::PrefRegistrySyncable* registry) {
115 RegisterProfilePrefs(registry); 124 RegisterProfilePrefs(registry);
116 } 125 }
OLDNEW
« no previous file with comments | « components/keyed_service/content/refcounted_browser_context_keyed_service_factory.cc ('k') | components/user_prefs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698