OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |