OLD | NEW |
1 // Copyright (c) 2010 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_value_map.h" | 5 #include "chrome/browser/prefs/pref_value_map.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 | 11 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 return false; | 53 return false; |
54 } | 54 } |
55 | 55 |
56 void PrefValueMap::Clear() { | 56 void PrefValueMap::Clear() { |
57 STLDeleteValues(&prefs_); | 57 STLDeleteValues(&prefs_); |
58 prefs_.clear(); | 58 prefs_.clear(); |
59 } | 59 } |
60 | 60 |
| 61 PrefValueMap::iterator PrefValueMap::begin() { |
| 62 return prefs_.begin(); |
| 63 } |
| 64 |
| 65 PrefValueMap::iterator PrefValueMap::end() { |
| 66 return prefs_.end(); |
| 67 } |
| 68 |
| 69 PrefValueMap::const_iterator PrefValueMap::begin() const { |
| 70 return prefs_.begin(); |
| 71 } |
| 72 |
| 73 PrefValueMap::const_iterator PrefValueMap::end() const { |
| 74 return prefs_.end(); |
| 75 } |
| 76 |
61 bool PrefValueMap::GetBoolean(const std::string& key, | 77 bool PrefValueMap::GetBoolean(const std::string& key, |
62 bool* value) const { | 78 bool* value) const { |
63 Value* stored_value = NULL; | 79 Value* stored_value = NULL; |
64 return GetValue(key, &stored_value) && stored_value->GetAsBoolean(value); | 80 return GetValue(key, &stored_value) && stored_value->GetAsBoolean(value); |
65 } | 81 } |
66 | 82 |
67 bool PrefValueMap::GetString(const std::string& key, | 83 bool PrefValueMap::GetString(const std::string& key, |
68 std::string* value) const { | 84 std::string* value) const { |
69 Value* stored_value = NULL; | 85 Value* stored_value = NULL; |
70 return GetValue(key, &stored_value) && stored_value->GetAsString(value); | 86 return GetValue(key, &stored_value) && stored_value->GetAsString(value); |
(...skipping 27 matching lines...) Expand all Loading... |
98 ++other_pref; | 114 ++other_pref; |
99 } | 115 } |
100 } | 116 } |
101 | 117 |
102 // Add the remaining entries. | 118 // Add the remaining entries. |
103 for ( ; this_pref != prefs_.end(); ++this_pref) | 119 for ( ; this_pref != prefs_.end(); ++this_pref) |
104 differing_keys->push_back(this_pref->first); | 120 differing_keys->push_back(this_pref->first); |
105 for ( ; other_pref != other->prefs_.end(); ++other_pref) | 121 for ( ; other_pref != other->prefs_.end(); ++other_pref) |
106 differing_keys->push_back(other_pref->first); | 122 differing_keys->push_back(other_pref->first); |
107 } | 123 } |
OLD | NEW |