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

Side by Side Diff: base/prefs/pref_service.cc

Issue 1096833003: Convert PrefSyncStatus into PrefRegistrationFlags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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 "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 DCHECK(CalledOnValidThread()); 309 DCHECK(CalledOnValidThread());
310 // Lookup the preference in the default store. 310 // Lookup the preference in the default store.
311 const base::Value* value = NULL; 311 const base::Value* value = NULL;
312 if (!pref_registry_->defaults()->GetValue(path, &value)) { 312 if (!pref_registry_->defaults()->GetValue(path, &value)) {
313 NOTREACHED() << "Default value missing for pref: " << path; 313 NOTREACHED() << "Default value missing for pref: " << path;
314 return NULL; 314 return NULL;
315 } 315 }
316 return value; 316 return value;
317 } 317 }
318 318
319 uint32 PrefService::GetRegistrationFlags(const std::string& path) const {
320 DCHECK(CalledOnValidThread());
321 const auto& it = pref_registry_->registration_flags().find(path);
322 if (it == pref_registry_->registration_flags().end()) {
Mattias Nissler (ping if slow) 2015/04/20 09:33:34 I'd prefer having this logic in PrefRegistry, and
raymes 2015/04/21 07:58:54 Sounds good but the function isn't used at all for
323 NOTREACHED() << "Registration flags missing for pref: " << path;
324 return PrefRegistry::NO_REGISTRATION_FLAGS;
325 }
326 return it->second;
327 }
328
319 const base::ListValue* PrefService::GetList(const std::string& path) const { 329 const base::ListValue* PrefService::GetList(const std::string& path) const {
320 DCHECK(CalledOnValidThread()); 330 DCHECK(CalledOnValidThread());
321 331
322 const base::Value* value = GetPreferenceValue(path); 332 const base::Value* value = GetPreferenceValue(path);
323 if (!value) { 333 if (!value) {
324 NOTREACHED() << "Trying to read an unregistered pref: " << path; 334 NOTREACHED() << "Trying to read an unregistered pref: " << path;
325 return NULL; 335 return NULL;
326 } 336 }
327 if (value->GetType() != base::Value::TYPE_LIST) { 337 if (value->GetType() != base::Value::TYPE_LIST) {
328 NOTREACHED(); 338 NOTREACHED();
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 DCHECK(found_value->IsType(default_type)); 594 DCHECK(found_value->IsType(default_type));
585 return found_value; 595 return found_value;
586 } else { 596 } else {
587 // Every registered preference has at least a default value. 597 // Every registered preference has at least a default value.
588 NOTREACHED() << "no valid value found for registered pref " << path; 598 NOTREACHED() << "no valid value found for registered pref " << path;
589 } 599 }
590 } 600 }
591 601
592 return NULL; 602 return NULL;
593 } 603 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698