| OLD | NEW |
| 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 "chrome/browser/profiles/profile_keyed_base_factory.h" | 5 #include "chrome/browser/profiles/profile_keyed_base_factory.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/profiles/profile_dependency_manager.h" | 9 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 10 #include "components/user_prefs/pref_registry_syncable.h" | 10 #include "components/user_prefs/pref_registry_syncable.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 profile and | 68 // to enforce a uniquenes check here because some tests create one profile and |
| 69 // multiple services of the same type attached to that profile (serially, not | 69 // multiple services of the same type attached to that profile (serially, not |
| 70 // parallel) and we don't want to register multiple times on the same profile. | 70 // parallel) and we don't want to register multiple times on the same profile. |
| 71 DCHECK(!profile->IsOffTheRecord()); | 71 DCHECK(!profile->IsOffTheRecord()); |
| 72 | 72 |
| 73 std::set<content::BrowserContext*>::iterator it = | 73 std::set<content::BrowserContext*>::iterator it = |
| 74 registered_preferences_.find(profile); | 74 registered_preferences_.find(profile); |
| 75 if (it == registered_preferences_.end()) { | 75 if (it == registered_preferences_.end()) { |
| 76 PrefService* prefs = components::UserPrefs::Get(profile); | 76 PrefService* prefs = components::UserPrefs::Get(profile); |
| 77 PrefRegistrySyncable* registry = static_cast<PrefRegistrySyncable*>( | 77 user_prefs::PrefRegistrySyncable* registry = |
| 78 prefs->DeprecatedGetPrefRegistry()); | 78 static_cast<user_prefs::PrefRegistrySyncable*>( |
| 79 prefs->DeprecatedGetPrefRegistry()); |
| 79 RegisterUserPrefs(registry); | 80 RegisterUserPrefs(registry); |
| 80 registered_preferences_.insert(profile); | 81 registered_preferences_.insert(profile); |
| 81 } | 82 } |
| 82 } | 83 } |
| 83 | 84 |
| 84 bool ProfileKeyedBaseFactory::ServiceIsCreatedWithProfile() const { | 85 bool ProfileKeyedBaseFactory::ServiceIsCreatedWithProfile() const { |
| 85 return false; | 86 return false; |
| 86 } | 87 } |
| 87 | 88 |
| 88 bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() const { | 89 bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() const { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 102 content::BrowserContext* profile) const { | 103 content::BrowserContext* profile) const { |
| 103 return registered_preferences_.find(profile) != | 104 return registered_preferences_.find(profile) != |
| 104 registered_preferences_.end(); | 105 registered_preferences_.end(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 void ProfileKeyedBaseFactory::MarkPreferencesSetOn( | 108 void ProfileKeyedBaseFactory::MarkPreferencesSetOn( |
| 108 content::BrowserContext* profile) { | 109 content::BrowserContext* profile) { |
| 109 DCHECK(!ArePreferencesSetOn(profile)); | 110 DCHECK(!ArePreferencesSetOn(profile)); |
| 110 registered_preferences_.insert(profile); | 111 registered_preferences_.insert(profile); |
| 111 } | 112 } |
| OLD | NEW |