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 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // Sets the value for |key| to the int |value|. | 65 // Sets the value for |key| to the int |value|. |
66 void SetInteger(const std::string& key, const int value); | 66 void SetInteger(const std::string& key, const int value); |
67 | 67 |
68 // Compares this value map against |other| and stores all key names that have | 68 // Compares this value map against |other| and stores all key names that have |
69 // different values in |differing_keys|. This includes keys that are present | 69 // different values in |differing_keys|. This includes keys that are present |
70 // only in one of the maps. | 70 // only in one of the maps. |
71 void GetDifferingKeys(const PrefValueMap* other, | 71 void GetDifferingKeys(const PrefValueMap* other, |
72 std::vector<std::string>* differing_keys) const; | 72 std::vector<std::string>* differing_keys) const; |
73 | 73 |
| 74 // Copies all entries in |other| to this value map. Overwrites any existing |
| 75 // value if a key already exists in this value map. |
| 76 void MergeFrom(const PrefValueMap* other); |
| 77 |
74 private: | 78 private: |
75 typedef std::map<std::string, base::Value*> Map; | 79 typedef std::map<std::string, base::Value*> Map; |
76 | 80 |
77 Map prefs_; | 81 Map prefs_; |
78 | 82 |
79 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); | 83 DISALLOW_COPY_AND_ASSIGN(PrefValueMap); |
80 }; | 84 }; |
81 | 85 |
82 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ | 86 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_MAP_H_ |
OLD | NEW |