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

Unified 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: Fix syntax 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 side-by-side diff with in-line comments
Download patch
Index: components/keyed_service/ios/browser_state_keyed_service_factory.cc
diff --git a/components/keyed_service/ios/browser_state_keyed_service_factory.cc b/components/keyed_service/ios/browser_state_keyed_service_factory.cc
index 115569281ab70ffd11eeed4791b7ecf7d67e03a4..3d2b751fc3934c01aa8a2bc305b2ec89d2ed0044 100644
--- a/components/keyed_service/ios/browser_state_keyed_service_factory.cc
+++ b/components/keyed_service/ios/browser_state_keyed_service_factory.cc
@@ -5,9 +5,12 @@
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "base/logging.h"
+#include "base/prefs/pref_service.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/keyed_service/ios/browser_state_helper.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "components/user_prefs/user_prefs.h"
#include "ios/web/public/browser_state.h"
void BrowserStateKeyedServiceFactory::SetTestingFactory(
@@ -87,8 +90,14 @@ bool BrowserStateKeyedServiceFactory::IsOffTheRecord(
user_prefs::PrefRegistrySyncable*
BrowserStateKeyedServiceFactory::GetAssociatedPrefRegistry(
base::SupportsUserData* context) const {
- NOTREACHED();
- return nullptr;
+ // TODO(droger): Move this code to KeyedServiceFactory and share it with the
+ // other platforms once iOS no longer needs BrowserStateFromContext().
+ PrefService* prefs =
+ user_prefs::UserPrefs::Get(BrowserStateFromContext(context));
Bernhard Bauer 2015/04/15 15:28:13 Why is the call to BrowserStateFromContext necessa
droger 2015/04/15 15:33:08 This is because we currently are in a temporary st
droger 2015/04/15 15:37:07 Also: BrowserStateFromContext() returns base::Supp
Bernhard Bauer 2015/04/15 15:39:54 Yes, that was what confused me :) For the content/
+ user_prefs::PrefRegistrySyncable* registry =
+ static_cast<user_prefs::PrefRegistrySyncable*>(
+ prefs->DeprecatedGetPrefRegistry());
+ return registry;
}
base::SupportsUserData* BrowserStateKeyedServiceFactory::GetContextToUse(
« 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