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

Side by Side Diff: chrome/browser/prefs/pref_value_store.cc

Issue 5646003: Sanitize PrefStore interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefService mock construction in PrefServiceTest to include command line store. Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/prefs/pref_value_store.h" 5 #include "chrome/browser/prefs/pref_value_store.h"
6 6
7 #include "chrome/browser/browser_thread.h" 7 #include "chrome/browser/browser_thread.h"
8 #include "chrome/browser/policy/configuration_policy_pref_store.h" 8 #include "chrome/browser/policy/configuration_policy_pref_store.h"
9 #include "chrome/browser/prefs/pref_notifier.h" 9 #include "chrome/browser/prefs/pref_notifier.h"
10 #include "chrome/common/notification_service.h" 10 #include "chrome/common/notification_service.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 PrefStore* device_management_prefs, 45 PrefStore* device_management_prefs,
46 PrefStore* extension_prefs, 46 PrefStore* extension_prefs,
47 PrefStore* command_line_prefs, 47 PrefStore* command_line_prefs,
48 PrefStore* user_prefs, 48 PrefStore* user_prefs,
49 PrefStore* recommended_prefs, 49 PrefStore* recommended_prefs,
50 PrefStore* default_prefs, 50 PrefStore* default_prefs,
51 PrefNotifier* pref_notifier, 51 PrefNotifier* pref_notifier,
52 Profile* profile) 52 Profile* profile)
53 : pref_notifier_(pref_notifier), 53 : pref_notifier_(pref_notifier),
54 profile_(profile) { 54 profile_(profile) {
55 // NULL default pref store is usually bad, but may be OK for some unit tests.
56 if (!default_prefs)
57 LOG(WARNING) << "default pref store is null";
58 InitPrefStore(MANAGED_PLATFORM_STORE, managed_platform_prefs); 55 InitPrefStore(MANAGED_PLATFORM_STORE, managed_platform_prefs);
59 InitPrefStore(DEVICE_MANAGEMENT_STORE, device_management_prefs); 56 InitPrefStore(DEVICE_MANAGEMENT_STORE, device_management_prefs);
60 InitPrefStore(EXTENSION_STORE, extension_prefs); 57 InitPrefStore(EXTENSION_STORE, extension_prefs);
61 InitPrefStore(COMMAND_LINE_STORE, command_line_prefs); 58 InitPrefStore(COMMAND_LINE_STORE, command_line_prefs);
62 InitPrefStore(USER_STORE, user_prefs); 59 InitPrefStore(USER_STORE, user_prefs);
63 InitPrefStore(RECOMMENDED_STORE, recommended_prefs); 60 InitPrefStore(RECOMMENDED_STORE, recommended_prefs);
64 InitPrefStore(DEFAULT_STORE, default_prefs); 61 InitPrefStore(DEFAULT_STORE, default_prefs);
65 62
66 // TODO(mnissler): Remove after policy refresh cleanup. 63 // TODO(mnissler): Remove after policy refresh cleanup.
67 registrar_.Add(this, 64 registrar_.Add(this,
(...skipping 10 matching lines...) Expand all
78 // Check the |PrefStore|s in order of their priority from highest to lowest 75 // Check the |PrefStore|s in order of their priority from highest to lowest
79 // to find the value of the preference described by the given preference name. 76 // to find the value of the preference described by the given preference name.
80 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { 77 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) {
81 if (GetValueFromStore(name.c_str(), static_cast<PrefStoreType>(i), 78 if (GetValueFromStore(name.c_str(), static_cast<PrefStoreType>(i),
82 out_value)) 79 out_value))
83 return true; 80 return true;
84 } 81 }
85 return false; 82 return false;
86 } 83 }
87 84
88 bool PrefValueStore::GetUserValue(const std::string& name,
89 Value** out_value) const {
90 return GetValueFromStore(name.c_str(), USER_STORE, out_value);
91 }
92
93 void PrefValueStore::RegisterPreferenceType(const std::string& name, 85 void PrefValueStore::RegisterPreferenceType(const std::string& name,
94 Value::ValueType type) { 86 Value::ValueType type) {
95 pref_types_[name] = type; 87 pref_types_[name] = type;
96 } 88 }
97 89
98 Value::ValueType PrefValueStore::GetRegisteredType( 90 Value::ValueType PrefValueStore::GetRegisteredType(
99 const std::string& name) const { 91 const std::string& name) const {
100 PrefTypeMap::const_iterator found = pref_types_.find(name); 92 PrefTypeMap::const_iterator found = pref_types_.find(name);
101 if (found == pref_types_.end()) 93 if (found == pref_types_.end())
102 return Value::TYPE_NULL; 94 return Value::TYPE_NULL;
103 return found->second; 95 return found->second;
104 } 96 }
105 97
106 bool PrefValueStore::WritePrefs() {
107 bool success = true;
108 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) {
109 PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(i));
110 if (store)
111 success = store->WritePrefs() && success;
112 }
113 return success;
114 }
115
116 void PrefValueStore::ScheduleWritePrefs() {
117 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) {
118 PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(i));
119 if (store)
120 store->ScheduleWritePrefs();
121 }
122 }
123
124 PrefStore::PrefReadError PrefValueStore::ReadPrefs() {
125 PrefStore::PrefReadError result = PrefStore::PREF_READ_ERROR_NONE;
126 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) {
127 PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(i));
128 if (store) {
129 PrefStore::PrefReadError this_error = store->ReadPrefs();
130 if (result == PrefStore::PREF_READ_ERROR_NONE)
131 result = this_error;
132 }
133 }
134
135 if (HasPolicyConflictingUserProxySettings()) {
136 LOG(WARNING) << "user-requested proxy options have been overridden"
137 << " by a proxy configuration specified in a centrally"
138 << " administered policy.";
139 }
140
141 // TODO(markusheintz): Return a better error status: maybe a struct with
142 // the error status of all PrefStores.
143 return result;
144 }
145
146 bool PrefValueStore::HasPrefPath(const char* path) const { 98 bool PrefValueStore::HasPrefPath(const char* path) const {
147 Value* tmp_value = NULL; 99 Value* tmp_value = NULL;
148 const std::string name(path); 100 const std::string name(path);
149 bool rv = GetValue(name, &tmp_value); 101 bool rv = GetValue(name, &tmp_value);
150 // Merely registering a pref doesn't count as "having" it: we require a 102 // Merely registering a pref doesn't count as "having" it: we require a
151 // non-default value set. 103 // non-default value set.
152 return rv && !PrefValueFromDefaultStore(path); 104 return rv && !PrefValueFromDefaultStore(path);
153 } 105 }
154 106
155 void PrefValueStore::NotifyPrefChanged( 107 void PrefValueStore::NotifyPrefChanged(
(...skipping 16 matching lines...) Expand all
172 if (controller != INVALID_STORE && 124 if (controller != INVALID_STORE &&
173 controller < new_store) { 125 controller < new_store) {
174 changed = false; 126 changed = false;
175 } 127 }
176 } 128 }
177 129
178 if (changed) 130 if (changed)
179 pref_notifier_->OnPreferenceChanged(path); 131 pref_notifier_->OnPreferenceChanged(path);
180 } 132 }
181 133
182 void PrefValueStore::SetUserPrefValue(const char* name, Value* in_value) {
183 DCHECK(in_value);
184 Value* old_value = NULL;
185 GetPrefStore(USER_STORE)->prefs()->Get(name, &old_value);
186 bool value_changed = !old_value || !old_value->Equals(in_value);
187 GetPrefStore(USER_STORE)->prefs()->Set(name, in_value);
188
189 if (value_changed)
190 NotifyPrefChanged(name, USER_STORE);
191 }
192
193 void PrefValueStore::SetUserPrefValueSilently(const char* name,
194 Value* in_value) {
195 DCHECK(in_value);
196 GetPrefStore(USER_STORE)->prefs()->Set(name, in_value);
197 }
198
199 bool PrefValueStore::ReadOnly() const {
200 return GetPrefStore(USER_STORE)->ReadOnly();
201 }
202
203 void PrefValueStore::RemoveUserPrefValue(const char* name) {
204 if (GetPrefStore(USER_STORE)) {
205 if (GetPrefStore(USER_STORE)->prefs()->Remove(name, NULL))
206 NotifyPrefChanged(name, USER_STORE);
207 }
208 }
209
210 bool PrefValueStore::PrefValueInManagedPlatformStore(const char* name) const { 134 bool PrefValueStore::PrefValueInManagedPlatformStore(const char* name) const {
211 return PrefValueInStore(name, MANAGED_PLATFORM_STORE); 135 return PrefValueInStore(name, MANAGED_PLATFORM_STORE);
212 } 136 }
213 137
214 bool PrefValueStore::PrefValueInDeviceManagementStore(const char* name) const { 138 bool PrefValueStore::PrefValueInDeviceManagementStore(const char* name) const {
215 return PrefValueInStore(name, DEVICE_MANAGEMENT_STORE); 139 return PrefValueInStore(name, DEVICE_MANAGEMENT_STORE);
216 } 140 }
217 141
218 bool PrefValueStore::PrefValueInExtensionStore(const char* name) const { 142 bool PrefValueStore::PrefValueInExtensionStore(const char* name) const {
219 return PrefValueInStore(name, EXTENSION_STORE); 143 return PrefValueInStore(name, EXTENSION_STORE);
(...skipping 14 matching lines...) Expand all
234 bool PrefValueStore::PrefValueFromDefaultStore(const char* name) const { 158 bool PrefValueStore::PrefValueFromDefaultStore(const char* name) const {
235 return ControllingPrefStoreForPref(name) == DEFAULT_STORE; 159 return ControllingPrefStoreForPref(name) == DEFAULT_STORE;
236 } 160 }
237 161
238 bool PrefValueStore::PrefValueUserModifiable(const char* name) const { 162 bool PrefValueStore::PrefValueUserModifiable(const char* name) const {
239 PrefStoreType effective_store = ControllingPrefStoreForPref(name); 163 PrefStoreType effective_store = ControllingPrefStoreForPref(name);
240 return effective_store >= USER_STORE || 164 return effective_store >= USER_STORE ||
241 effective_store == INVALID_STORE; 165 effective_store == INVALID_STORE;
242 } 166 }
243 167
244 bool PrefValueStore::HasPolicyConflictingUserProxySettings() const {
245 using policy::ConfigurationPolicyPrefStore;
246 ConfigurationPolicyPrefStore::ProxyPreferenceSet proxy_prefs;
247 ConfigurationPolicyPrefStore::GetProxyPreferenceSet(&proxy_prefs);
248 ConfigurationPolicyPrefStore::ProxyPreferenceSet::const_iterator i;
249 for (i = proxy_prefs.begin(); i != proxy_prefs.end(); ++i) {
250 if ((PrefValueInManagedPlatformStore(*i) ||
251 PrefValueInDeviceManagementStore(*i)) &&
252 PrefValueInStoreRange(*i,
253 COMMAND_LINE_STORE,
254 USER_STORE))
255 return true;
256 }
257 return false;
258 }
259
260 // Returns true if the actual value is a valid type for the expected type when 168 // Returns true if the actual value is a valid type for the expected type when
261 // found in the given store. 169 // found in the given store.
262 bool PrefValueStore::IsValidType(Value::ValueType expected, 170 bool PrefValueStore::IsValidType(Value::ValueType expected,
263 Value::ValueType actual, 171 Value::ValueType actual,
264 PrefValueStore::PrefStoreType store) { 172 PrefValueStore::PrefStoreType store) {
265 if (expected == actual) 173 if (expected == actual)
266 return true; 174 return true;
267 175
268 // Dictionaries and lists are allowed to hold TYPE_NULL values too, but only 176 // Dictionaries and lists are allowed to hold TYPE_NULL values too, but only
269 // in the default pref store. 177 // in the default pref store.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 217 }
310 return INVALID_STORE; 218 return INVALID_STORE;
311 } 219 }
312 220
313 bool PrefValueStore::GetValueFromStore(const char* name, 221 bool PrefValueStore::GetValueFromStore(const char* name,
314 PrefValueStore::PrefStoreType store_type, 222 PrefValueStore::PrefStoreType store_type,
315 Value** out_value) const { 223 Value** out_value) const {
316 // Only return true if we find a value and it is the correct type, so stale 224 // Only return true if we find a value and it is the correct type, so stale
317 // values with the incorrect type will be ignored. 225 // values with the incorrect type will be ignored.
318 const PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(store_type)); 226 const PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(store_type));
319 if (store && store->prefs()->Get(name, out_value)) { 227 if (store) {
320 // If the value is the sentinel that redirects to the default store, 228 switch (store->GetValue(name, out_value)) {
321 // re-fetch the value from the default store explicitly. Because the default 229 case PrefStore::READ_USE_DEFAULT:
322 // values are not available when creating stores, the default value must be 230 store = GetPrefStore(DEFAULT_STORE);
323 // fetched dynamically for every redirect. 231 if (!store || store->GetValue(name, out_value) != PrefStore::READ_OK) {
324 if (PrefStore::IsUseDefaultSentinelValue(*out_value)) { 232 *out_value = NULL;
325 store = GetPrefStore(DEFAULT_STORE); 233 return false;
326 if (!store || !store->prefs()->Get(name, out_value)) { 234 }
327 *out_value = NULL; 235 // Fall through...
328 return false; 236 case PrefStore::READ_OK:
329 } 237 if (IsValidType(GetRegisteredType(name),
330 store_type = DEFAULT_STORE; 238 (*out_value)->GetType(),
331 } 239 store_type)) {
332 if (IsValidType(GetRegisteredType(name), 240 return true;
333 (*out_value)->GetType(), 241 }
334 store_type)) { 242 break;
335 return true; 243 case PrefStore::READ_NO_VALUE:
244 break;
336 } 245 }
337 } 246 }
247
338 // No valid value found for the given preference name: set the return false. 248 // No valid value found for the given preference name: set the return false.
339 *out_value = NULL; 249 *out_value = NULL;
340 return false; 250 return false;
341 } 251 }
342 252
343 void PrefValueStore::RefreshPolicyPrefsOnFileThread( 253 void PrefValueStore::RefreshPolicyPrefsOnFileThread(
344 BrowserThread::ID calling_thread_id, 254 BrowserThread::ID calling_thread_id,
345 PrefStore* new_managed_platform_pref_store, 255 policy::ConfigurationPolicyPrefStore* new_managed_platform_pref_store,
346 PrefStore* new_device_management_pref_store, 256 policy::ConfigurationPolicyPrefStore* new_device_management_pref_store,
347 PrefStore* new_recommended_pref_store) { 257 policy::ConfigurationPolicyPrefStore* new_recommended_pref_store) {
348 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
349 scoped_ptr<PrefStore> managed_platform_pref_store( 259 scoped_ptr<policy::ConfigurationPolicyPrefStore> managed_platform_pref_store(
350 new_managed_platform_pref_store); 260 new_managed_platform_pref_store);
351 scoped_ptr<PrefStore> device_management_pref_store( 261 scoped_ptr<policy::ConfigurationPolicyPrefStore> device_management_pref_store(
352 new_device_management_pref_store); 262 new_device_management_pref_store);
353 scoped_ptr<PrefStore> recommended_pref_store(new_recommended_pref_store); 263 scoped_ptr<policy::ConfigurationPolicyPrefStore> recommended_pref_store(
354 264 new_recommended_pref_store);
355 PrefStore::PrefReadError read_error =
356 new_managed_platform_pref_store->ReadPrefs();
357 if (read_error != PrefStore::PREF_READ_ERROR_NONE) {
358 LOG(ERROR) << "refresh of managed policy failed: PrefReadError = "
359 << read_error;
360 return;
361 }
362
363 read_error = new_device_management_pref_store->ReadPrefs();
364 if (read_error != PrefStore::PREF_READ_ERROR_NONE) {
365 LOG(ERROR) << "refresh of device management policy failed: "
366 << "PrefReadError = " << read_error;
367 return;
368 }
369
370 read_error = new_recommended_pref_store->ReadPrefs();
371 if (read_error != PrefStore::PREF_READ_ERROR_NONE) {
372 LOG(ERROR) << "refresh of recommended policy failed: PrefReadError = "
373 << read_error;
374 return;
375 }
376 265
377 BrowserThread::PostTask( 266 BrowserThread::PostTask(
378 calling_thread_id, FROM_HERE, 267 calling_thread_id, FROM_HERE,
379 NewRunnableMethod(this, 268 NewRunnableMethod(this,
380 &PrefValueStore::RefreshPolicyPrefsCompletion, 269 &PrefValueStore::RefreshPolicyPrefsCompletion,
381 managed_platform_pref_store.release(), 270 managed_platform_pref_store.release(),
382 device_management_pref_store.release(), 271 device_management_pref_store.release(),
383 recommended_pref_store.release())); 272 recommended_pref_store.release()));
384 } 273 }
385 274
386 void PrefValueStore::RefreshPolicyPrefs() { 275 void PrefValueStore::RefreshPolicyPrefs() {
387 using policy::ConfigurationPolicyPrefStore; 276 using policy::ConfigurationPolicyPrefStore;
388 // Because loading of policy information must happen on the FILE 277 // Because loading of policy information must happen on the FILE
389 // thread, it's not possible to just replace the contents of the 278 // thread, it's not possible to just replace the contents of the
390 // managed and recommended stores in place due to possible 279 // managed and recommended stores in place due to possible
391 // concurrent access from the UI thread. Instead, new stores are 280 // concurrent access from the UI thread. Instead, new stores are
392 // created and the refreshed policy read into them. The new stores 281 // created and the refreshed policy read into them. The new stores
393 // are swapped with the old from a Task on the UI thread after the 282 // are swapped with the old from a Task on the UI thread after the
394 // load is complete. 283 // load is complete.
395 PrefStore* new_managed_platform_pref_store( 284 ConfigurationPolicyPrefStore* new_managed_platform_pref_store(
396 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore()); 285 ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore());
397 PrefStore* new_device_management_pref_store( 286 ConfigurationPolicyPrefStore* new_device_management_pref_store(
398 ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( 287 ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore(
399 profile_)); 288 profile_));
400 PrefStore* new_recommended_pref_store( 289 ConfigurationPolicyPrefStore* new_recommended_pref_store(
401 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore()); 290 ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore());
402 BrowserThread::ID current_thread_id; 291 BrowserThread::ID current_thread_id;
403 CHECK(BrowserThread::GetCurrentThreadIdentifier(&current_thread_id)); 292 CHECK(BrowserThread::GetCurrentThreadIdentifier(&current_thread_id));
404 BrowserThread::PostTask( 293 BrowserThread::PostTask(
405 BrowserThread::FILE, FROM_HERE, 294 BrowserThread::FILE, FROM_HERE,
406 NewRunnableMethod(this, 295 NewRunnableMethod(this,
407 &PrefValueStore::RefreshPolicyPrefsOnFileThread, 296 &PrefValueStore::RefreshPolicyPrefsOnFileThread,
408 current_thread_id, 297 current_thread_id,
409 new_managed_platform_pref_store, 298 new_managed_platform_pref_store,
410 new_device_management_pref_store, 299 new_device_management_pref_store,
411 new_recommended_pref_store)); 300 new_recommended_pref_store));
412 } 301 }
413 302
414 void PrefValueStore::RefreshPolicyPrefsCompletion( 303 void PrefValueStore::RefreshPolicyPrefsCompletion(
415 PrefStore* new_managed_platform_pref_store, 304 policy::ConfigurationPolicyPrefStore* new_managed_platform_pref_store,
416 PrefStore* new_device_management_pref_store, 305 policy::ConfigurationPolicyPrefStore* new_device_management_pref_store,
417 PrefStore* new_recommended_pref_store) { 306 policy::ConfigurationPolicyPrefStore* new_recommended_pref_store) {
418 // Determine the paths of all the changed preferences values in the three 307 // Determine the paths of all the changed preferences values in the three
419 // policy-related stores (managed platform, device management and 308 // policy-related stores (managed platform, device management and
420 // recommended). 309 // recommended).
421 DictionaryValue* managed_platform_prefs_before( 310 DictionaryValue* managed_platform_prefs_before(
422 GetPrefStore(MANAGED_PLATFORM_STORE)->prefs()); 311 static_cast<policy::ConfigurationPolicyPrefStore*>(
312 GetPrefStore(MANAGED_PLATFORM_STORE))->prefs());
423 DictionaryValue* managed_platform_prefs_after( 313 DictionaryValue* managed_platform_prefs_after(
424 new_managed_platform_pref_store->prefs()); 314 new_managed_platform_pref_store->prefs());
425 DictionaryValue* device_management_prefs_before( 315 DictionaryValue* device_management_prefs_before(
426 GetPrefStore(DEVICE_MANAGEMENT_STORE)->prefs()); 316 static_cast<policy::ConfigurationPolicyPrefStore*>(
317 GetPrefStore(DEVICE_MANAGEMENT_STORE))->prefs());
427 DictionaryValue* device_management_prefs_after( 318 DictionaryValue* device_management_prefs_after(
428 new_device_management_pref_store->prefs()); 319 new_device_management_pref_store->prefs());
429 DictionaryValue* recommended_prefs_before( 320 DictionaryValue* recommended_prefs_before(
430 GetPrefStore(RECOMMENDED_STORE)->prefs()); 321 static_cast<policy::ConfigurationPolicyPrefStore*>(
322 GetPrefStore(RECOMMENDED_STORE))->prefs());
431 DictionaryValue* recommended_prefs_after(new_recommended_pref_store->prefs()); 323 DictionaryValue* recommended_prefs_after(new_recommended_pref_store->prefs());
432 324
433 std::vector<std::string> changed_managed_platform_paths; 325 std::vector<std::string> changed_managed_platform_paths;
434 managed_platform_prefs_before->GetDifferingPaths(managed_platform_prefs_after, 326 managed_platform_prefs_before->GetDifferingPaths(
435 &changed_managed_platform_paths); 327 managed_platform_prefs_after,
328 &changed_managed_platform_paths);
436 329
437 std::vector<std::string> changed_device_management_paths; 330 std::vector<std::string> changed_device_management_paths;
438 device_management_prefs_before->GetDifferingPaths( 331 device_management_prefs_before->GetDifferingPaths(
439 device_management_prefs_after, 332 device_management_prefs_after,
440 &changed_device_management_paths); 333 &changed_device_management_paths);
441 334
442 std::vector<std::string> changed_recommended_paths; 335 std::vector<std::string> changed_recommended_paths;
443 recommended_prefs_before->GetDifferingPaths(recommended_prefs_after, 336 recommended_prefs_before->GetDifferingPaths(
444 &changed_recommended_paths); 337 recommended_prefs_after,
338 &changed_recommended_paths);
445 339
446 // Merge all three vectors of changed value paths together, filtering 340 // Merge all three vectors of changed value paths together, filtering
447 // duplicates in a post-processing step. 341 // duplicates in a post-processing step.
448 std::vector<std::string> all_changed_managed_platform_paths( 342 std::vector<std::string> all_changed_managed_platform_paths(
449 changed_managed_platform_paths.size() + 343 changed_managed_platform_paths.size() +
450 changed_device_management_paths.size()); 344 changed_device_management_paths.size());
451 345
452 std::vector<std::string>::iterator last_insert = 346 std::vector<std::string>::iterator last_insert =
453 std::merge(changed_managed_platform_paths.begin(), 347 std::merge(changed_managed_platform_paths.begin(),
454 changed_managed_platform_paths.end(), 348 changed_managed_platform_paths.end(),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 402 }
509 403
510 void PrefValueStore::CheckInitializationCompleted() { 404 void PrefValueStore::CheckInitializationCompleted() {
511 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { 405 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) {
512 PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(i)); 406 PrefStore* store = GetPrefStore(static_cast<PrefStoreType>(i));
513 if (store && !store->IsInitializationComplete()) 407 if (store && !store->IsInitializationComplete())
514 return; 408 return;
515 } 409 }
516 pref_notifier_->OnInitializationCompleted(); 410 pref_notifier_->OnInitializationCompleted();
517 } 411 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_value_store.h ('k') | chrome/browser/prefs/pref_value_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698