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

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

Issue 6353015: Fix broken PrefService::preference_set() returning not all registered preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_service.h" 5 #include "chrome/browser/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 result = base::SysWideToNativeMB(UTF8ToWide(result)); 349 result = base::SysWideToNativeMB(UTF8ToWide(result));
350 #endif 350 #endif
351 return FilePath(result); 351 return FilePath(result);
352 } 352 }
353 353
354 bool PrefService::HasPrefPath(const char* path) const { 354 bool PrefService::HasPrefPath(const char* path) const {
355 const Preference* pref = FindPreference(path); 355 const Preference* pref = FindPreference(path);
356 return pref && !pref->IsDefaultValue(); 356 return pref && !pref->IsDefaultValue();
357 } 357 }
358 358
359 void PrefService::GetPreferenceValues(DictionaryValue* out) const {
360 DCHECK(CalledOnValidThread());
361 DefaultPrefStore::const_iterator i = default_store_->begin();
362 for (; i != default_store_->end(); ++i) {
363 const Value* value = FindPreference(i->first.c_str())->GetValue();
364 out->Set(i->first, value->DeepCopy());
Mattias Nissler (ping if slow) 2011/01/26 17:55:11 So here is the problem that Set splits up the path
battre 2011/01/27 09:53:27 This is what the currently only consumer expects t
365 }
366 }
367
359 const PrefService::Preference* PrefService::FindPreference( 368 const PrefService::Preference* PrefService::FindPreference(
360 const char* pref_name) const { 369 const char* pref_name) const {
361 DCHECK(CalledOnValidThread()); 370 DCHECK(CalledOnValidThread());
362 Preference p(this, pref_name, Value::TYPE_NULL); 371 Preference p(this, pref_name, Value::TYPE_NULL);
363 PreferenceSet::const_iterator it = prefs_.find(&p); 372 PreferenceSet::const_iterator it = prefs_.find(&p);
364 if (it != prefs_.end()) 373 if (it != prefs_.end())
365 return *it; 374 return *it;
366 const Value::ValueType type = default_store_->GetType(pref_name); 375 const Value::ValueType type = default_store_->GetType(pref_name);
367 if (type == Value::TYPE_NULL) 376 if (type == Value::TYPE_NULL)
368 return NULL; 377 return NULL;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 668
660 bool PrefService::Preference::IsDefaultValue() const { 669 bool PrefService::Preference::IsDefaultValue() const {
661 return pref_service_->pref_value_store_-> 670 return pref_service_->pref_value_store_->
662 PrefValueFromDefaultStore(name_.c_str()); 671 PrefValueFromDefaultStore(name_.c_str());
663 } 672 }
664 673
665 bool PrefService::Preference::IsUserModifiable() const { 674 bool PrefService::Preference::IsUserModifiable() const {
666 return pref_service_->pref_value_store_-> 675 return pref_service_->pref_value_store_->
667 PrefValueUserModifiable(name_.c_str()); 676 PrefValueUserModifiable(name_.c_str());
668 } 677 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698