| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
| 12 PrefValueMap::PrefValueMap() {} |
| 13 |
| 12 PrefValueMap::~PrefValueMap() { | 14 PrefValueMap::~PrefValueMap() { |
| 13 Clear(); | 15 Clear(); |
| 14 } | 16 } |
| 15 | 17 |
| 16 bool PrefValueMap::GetValue(const std::string& key, Value** value) const { | 18 bool PrefValueMap::GetValue(const std::string& key, Value** value) const { |
| 17 const Map::const_iterator entry = prefs_.find(key); | 19 const Map::const_iterator entry = prefs_.find(key); |
| 18 if (entry != prefs_.end()) { | 20 if (entry != prefs_.end()) { |
| 19 if (value) | 21 if (value) |
| 20 *value = entry->second; | 22 *value = entry->second; |
| 21 return true; | 23 return true; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 48 return true; | 50 return true; |
| 49 } | 51 } |
| 50 | 52 |
| 51 return false; | 53 return false; |
| 52 } | 54 } |
| 53 | 55 |
| 54 void PrefValueMap::Clear() { | 56 void PrefValueMap::Clear() { |
| 55 STLDeleteValues(&prefs_); | 57 STLDeleteValues(&prefs_); |
| 56 prefs_.clear(); | 58 prefs_.clear(); |
| 57 } | 59 } |
| OLD | NEW |