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 "components/prefs/pref_value_map.h" | 5 #include "components/prefs/pref_value_map.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 | 14 |
15 PrefValueMap::PrefValueMap() {} | 15 PrefValueMap::PrefValueMap() {} |
16 | 16 |
17 PrefValueMap::~PrefValueMap() {} | 17 PrefValueMap::~PrefValueMap() {} |
18 | 18 |
19 bool PrefValueMap::GetValue(const std::string& key, | 19 bool PrefValueMap::GetValue(const std::string& key, |
20 const base::Value** value) const { | 20 const base::Value** value) const { |
| 21 if (!key.compare("settings.display.properties")) { |
| 22 LOG(ERROR) << "PrefValueMap::GetValue 1 key: "<< key; |
| 23 for (auto it = prefs_.begin(); it != prefs_.end(); ++it) |
| 24 LOG(ERROR) << "PrefValueMap key: " << it->first; |
| 25 } |
21 auto it = prefs_.find(key); | 26 auto it = prefs_.find(key); |
22 if (it == prefs_.end()) | 27 if (it == prefs_.end()) |
23 return false; | 28 return false; |
24 | 29 |
| 30 if (!key.compare("settings.display.properties")) |
| 31 LOG(ERROR) << "PrefValueMap::GetValue 2 key: "<< key; |
25 const base::Value* got_value = it->second.get(); | 32 const base::Value* got_value = it->second.get(); |
26 if (value && got_value) | 33 if (value && got_value) |
27 *value = got_value; | 34 *value = got_value; |
28 | 35 |
| 36 if (!key.compare("settings.display.properties")) |
| 37 LOG(ERROR) << "PrefValueMap::GetValue 3 key: "<< key; |
29 return !!got_value; | 38 return !!got_value; |
30 } | 39 } |
31 | 40 |
32 bool PrefValueMap::GetValue(const std::string& key, base::Value** value) { | 41 bool PrefValueMap::GetValue(const std::string& key, base::Value** value) { |
| 42 if (!key.compare("settings.display.properties")) |
| 43 LOG(ERROR) << "PrefValueMap::GetValue key: "<< key; |
33 auto it = prefs_.find(key); | 44 auto it = prefs_.find(key); |
34 if (it == prefs_.end()) | 45 if (it == prefs_.end()) |
35 return false; | 46 return false; |
36 | 47 |
37 base::Value* got_value = it->second.get(); | 48 base::Value* got_value = it->second.get(); |
38 if (value && got_value) | 49 if (value && got_value) |
39 *value = got_value; | 50 *value = got_value; |
40 | 51 |
41 return !!got_value; | 52 return !!got_value; |
42 } | 53 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 differing_keys->push_back(other_pref->first); | 169 differing_keys->push_back(other_pref->first); |
159 } | 170 } |
160 | 171 |
161 std::unique_ptr<base::DictionaryValue> PrefValueMap::AsDictionaryValue() const { | 172 std::unique_ptr<base::DictionaryValue> PrefValueMap::AsDictionaryValue() const { |
162 auto dictionary = base::MakeUnique<base::DictionaryValue>(); | 173 auto dictionary = base::MakeUnique<base::DictionaryValue>(); |
163 for (const auto& value : prefs_) { | 174 for (const auto& value : prefs_) { |
164 dictionary->Set(value.first, value.second->CreateDeepCopy()); | 175 dictionary->Set(value.first, value.second->CreateDeepCopy()); |
165 } | 176 } |
166 return dictionary; | 177 return dictionary; |
167 } | 178 } |
OLD | NEW |