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

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: Addressed comments 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
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/value_map_pref_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 DictionaryValue* PrefService::GetPreferenceValues() const {
360 DCHECK(CalledOnValidThread());
361 DictionaryValue* out = new DictionaryValue;
362 DefaultPrefStore::const_iterator i = default_store_->begin();
363 for (; i != default_store_->end(); ++i) {
364 const Value* value = FindPreference(i->first.c_str())->GetValue();
365 out->Set(i->first, value->DeepCopy());
366 }
367 return out;
368 }
369
359 const PrefService::Preference* PrefService::FindPreference( 370 const PrefService::Preference* PrefService::FindPreference(
360 const char* pref_name) const { 371 const char* pref_name) const {
361 DCHECK(CalledOnValidThread()); 372 DCHECK(CalledOnValidThread());
362 Preference p(this, pref_name, Value::TYPE_NULL); 373 Preference p(this, pref_name, Value::TYPE_NULL);
363 PreferenceSet::const_iterator it = prefs_.find(&p); 374 PreferenceSet::const_iterator it = prefs_.find(&p);
364 if (it != prefs_.end()) 375 if (it != prefs_.end())
365 return *it; 376 return *it;
366 const Value::ValueType type = default_store_->GetType(pref_name); 377 const Value::ValueType type = default_store_->GetType(pref_name);
367 if (type == Value::TYPE_NULL) 378 if (type == Value::TYPE_NULL)
368 return NULL; 379 return NULL;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 670
660 bool PrefService::Preference::IsDefaultValue() const { 671 bool PrefService::Preference::IsDefaultValue() const {
661 return pref_service_->pref_value_store_-> 672 return pref_service_->pref_value_store_->
662 PrefValueFromDefaultStore(name_.c_str()); 673 PrefValueFromDefaultStore(name_.c_str());
663 } 674 }
664 675
665 bool PrefService::Preference::IsUserModifiable() const { 676 bool PrefService::Preference::IsUserModifiable() const {
666 return pref_service_->pref_value_store_-> 677 return pref_service_->pref_value_store_->
667 PrefValueUserModifiable(name_.c_str()); 678 PrefValueUserModifiable(name_.c_str());
668 } 679 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/value_map_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698