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

Side by Side Diff: components/browser_context_keyed_service/browser_context_keyed_base_factory.cc

Issue 16625004: components: Move user_prefs into user_prefs namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 (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 "components/browser_context_keyed_service/browser_context_keyed_base_fa ctory.h" 5 #include "components/browser_context_keyed_service/browser_context_keyed_base_fa ctory.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 8 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
9 #include "components/user_prefs/pref_registry_syncable.h" 9 #include "components/user_prefs/pref_registry_syncable.h"
10 #include "components/user_prefs/user_prefs.h" 10 #include "components/user_prefs/user_prefs.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // 66 //
67 // Now that services are responsible for declaring their preferences, we have 67 // Now that services are responsible for declaring their preferences, we have
68 // to enforce a uniquenes check here because some tests create one context and 68 // to enforce a uniquenes check here because some tests create one context and
69 // multiple services of the same type attached to that context (serially, not 69 // multiple services of the same type attached to that context (serially, not
70 // parallel) and we don't want to register multiple times on the same context. 70 // parallel) and we don't want to register multiple times on the same context.
71 DCHECK(!context->IsOffTheRecord()); 71 DCHECK(!context->IsOffTheRecord());
72 72
73 std::set<content::BrowserContext*>::iterator it = 73 std::set<content::BrowserContext*>::iterator it =
74 registered_preferences_.find(context); 74 registered_preferences_.find(context);
75 if (it == registered_preferences_.end()) { 75 if (it == registered_preferences_.end()) {
76 PrefService* prefs = components::UserPrefs::Get(context); 76 PrefService* prefs = user_prefs::UserPrefs::Get(context);
77 user_prefs::PrefRegistrySyncable* registry = 77 user_prefs::PrefRegistrySyncable* registry =
78 static_cast<user_prefs::PrefRegistrySyncable*>( 78 static_cast<user_prefs::PrefRegistrySyncable*>(
79 prefs->DeprecatedGetPrefRegistry()); 79 prefs->DeprecatedGetPrefRegistry());
80 RegisterUserPrefs(registry); 80 RegisterUserPrefs(registry);
81 registered_preferences_.insert(context); 81 registered_preferences_.insert(context);
82 } 82 }
83 } 83 }
84 84
85 bool 85 bool
86 BrowserContextKeyedBaseFactory::ServiceIsCreatedWithBrowserContext() const { 86 BrowserContextKeyedBaseFactory::ServiceIsCreatedWithBrowserContext() const {
(...skipping 17 matching lines...) Expand all
104 content::BrowserContext* context) const { 104 content::BrowserContext* context) const {
105 return registered_preferences_.find(context) != 105 return registered_preferences_.find(context) !=
106 registered_preferences_.end(); 106 registered_preferences_.end();
107 } 107 }
108 108
109 void BrowserContextKeyedBaseFactory::MarkPreferencesSetOn( 109 void BrowserContextKeyedBaseFactory::MarkPreferencesSetOn(
110 content::BrowserContext* context) { 110 content::BrowserContext* context) {
111 DCHECK(!ArePreferencesSetOn(context)); 111 DCHECK(!ArePreferencesSetOn(context));
112 registered_preferences_.insert(context); 112 registered_preferences_.insert(context);
113 } 113 }
OLDNEW
« no previous file with comments | « components/autofill/browser/personal_data_manager.cc ('k') | components/user_prefs/user_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698