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 "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/profiles/profile_dependency_manager.h" | 8 #include "chrome/browser/profiles/profile_dependency_manager.h" |
9 | 9 |
10 ProfileKeyedBaseFactory::ProfileKeyedBaseFactory( | 10 ProfileKeyedBaseFactory::ProfileKeyedBaseFactory( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // parallel) and we don't want to register multiple times on the same profile. | 74 // parallel) and we don't want to register multiple times on the same profile. |
75 DCHECK(!profile->IsOffTheRecord()); | 75 DCHECK(!profile->IsOffTheRecord()); |
76 | 76 |
77 std::set<Profile*>::iterator it = registered_preferences_.find(profile); | 77 std::set<Profile*>::iterator it = registered_preferences_.find(profile); |
78 if (it == registered_preferences_.end()) { | 78 if (it == registered_preferences_.end()) { |
79 RegisterUserPrefs(profile->GetPrefs()); | 79 RegisterUserPrefs(profile->GetPrefs()); |
80 registered_preferences_.insert(profile); | 80 registered_preferences_.insert(profile); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 void ProfileKeyedBaseFactory::ForceRegisterPrefsForTest(PrefService* prefs) { | 84 bool ProfileKeyedBaseFactory::ServiceRedirectedInIncognito() const { |
85 RegisterUserPrefs(prefs); | |
86 } | |
87 | |
88 bool ProfileKeyedBaseFactory::ServiceRedirectedInIncognito() { | |
89 return false; | 85 return false; |
90 } | 86 } |
91 | 87 |
92 bool ProfileKeyedBaseFactory::ServiceHasOwnInstanceInIncognito() { | 88 bool ProfileKeyedBaseFactory::ServiceHasOwnInstanceInIncognito() const { |
93 return false; | 89 return false; |
94 } | 90 } |
95 | 91 |
96 bool ProfileKeyedBaseFactory::ServiceIsCreatedWithProfile() { | 92 bool ProfileKeyedBaseFactory::ServiceIsCreatedWithProfile() const { |
97 return false; | 93 return false; |
98 } | 94 } |
99 | 95 |
100 bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() { | 96 bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() const { |
101 return false; | 97 return false; |
102 } | 98 } |
103 | 99 |
104 void ProfileKeyedBaseFactory::ProfileDestroyed(Profile* profile) { | 100 void ProfileKeyedBaseFactory::ProfileDestroyed(Profile* profile) { |
105 // While object destruction can be customized in ways where the object is | 101 // While object destruction can be customized in ways where the object is |
106 // only dereferenced, this still must run on the UI thread. | 102 // only dereferenced, this still must run on the UI thread. |
107 DCHECK(CalledOnValidThread()); | 103 DCHECK(CalledOnValidThread()); |
108 | 104 |
109 registered_preferences_.erase(profile); | 105 registered_preferences_.erase(profile); |
110 } | 106 } |
111 | 107 |
112 bool ProfileKeyedBaseFactory::ArePreferencesSetOn(Profile* profile) { | 108 bool ProfileKeyedBaseFactory::ArePreferencesSetOn(Profile* profile) const { |
113 return registered_preferences_.find(profile) != | 109 return registered_preferences_.find(profile) != |
114 registered_preferences_.end(); | 110 registered_preferences_.end(); |
115 } | 111 } |
116 | 112 |
117 void ProfileKeyedBaseFactory::MarkPreferencesSetOn(Profile* profile) { | 113 void ProfileKeyedBaseFactory::MarkPreferencesSetOn(Profile* profile) { |
118 DCHECK(!ArePreferencesSetOn(profile)); | 114 DCHECK(!ArePreferencesSetOn(profile)); |
119 registered_preferences_.insert(profile); | 115 registered_preferences_.insert(profile); |
120 } | 116 } |
OLD | NEW |