OLD | NEW |
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/default_pref_store.h" | 5 #include "base/prefs/default_pref_store.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 | 7 |
8 using base::Value; | 8 using base::Value; |
9 | 9 |
10 DefaultPrefStore::DefaultPrefStore() {} | 10 DefaultPrefStore::DefaultPrefStore() {} |
11 | 11 |
12 bool DefaultPrefStore::GetValue( | 12 bool DefaultPrefStore::GetValue( |
13 const std::string& key, | 13 const std::string& key, |
14 const base::Value** result) const { | 14 const base::Value** result) const { |
15 return prefs_.GetValue(key, result); | 15 return prefs_.GetValue(key, result); |
16 } | 16 } |
17 | 17 |
18 void DefaultPrefStore::SetDefaultValue(const std::string& key, Value* value) { | 18 void DefaultPrefStore::SetDefaultValue(const std::string& key, Value* value) { |
19 DCHECK(!GetValue(key, NULL)); | 19 DCHECK(!GetValue(key, NULL)); |
20 prefs_.SetValue(key, value); | 20 prefs_.SetValue(key, value); |
21 } | 21 } |
22 | 22 |
23 void DefaultPrefStore::RemoveDefaultValue(const std::string& key) { | 23 void DefaultPrefStore::RemoveDefaultValue(const std::string& key) { |
24 DCHECK(GetValue(key, NULL)); | 24 DCHECK(GetValue(key, NULL)); |
25 prefs_.RemoveValue(key); | 25 prefs_.RemoveValue(key); |
26 } | 26 } |
27 | 27 |
28 base::Value::Type DefaultPrefStore::GetType(const std::string& key) const { | |
29 const Value* value = NULL; | |
30 return GetValue(key, &value) ? value->GetType() : Value::TYPE_NULL; | |
31 } | |
32 | |
33 DefaultPrefStore::const_iterator DefaultPrefStore::begin() const { | 28 DefaultPrefStore::const_iterator DefaultPrefStore::begin() const { |
34 return prefs_.begin(); | 29 return prefs_.begin(); |
35 } | 30 } |
36 | 31 |
37 DefaultPrefStore::const_iterator DefaultPrefStore::end() const { | 32 DefaultPrefStore::const_iterator DefaultPrefStore::end() const { |
38 return prefs_.end(); | 33 return prefs_.end(); |
39 } | 34 } |
40 | 35 |
41 DefaultPrefStore::~DefaultPrefStore() {} | 36 DefaultPrefStore::~DefaultPrefStore() {} |
OLD | NEW |