Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: chrome/browser/prefs/pref_value_map.cc

Issue 7520023: Converted IncognitoForced boolean policy into IncognitoModeAvailability enum policy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed unnecessary comment. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/pref_value_map.h ('k') | chrome/browser/prefs/pref_value_map_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 std::string* value) const { 95 std::string* value) const {
96 const Value* stored_value = NULL; 96 const Value* stored_value = NULL;
97 return GetValue(key, &stored_value) && stored_value->GetAsString(value); 97 return GetValue(key, &stored_value) && stored_value->GetAsString(value);
98 } 98 }
99 99
100 void PrefValueMap::SetString(const std::string& key, 100 void PrefValueMap::SetString(const std::string& key,
101 const std::string& value) { 101 const std::string& value) {
102 SetValue(key, Value::CreateStringValue(value)); 102 SetValue(key, Value::CreateStringValue(value));
103 } 103 }
104 104
105 bool PrefValueMap::GetInteger(const std::string& key, int* value) const {
106 const Value* stored_value = NULL;
107 return GetValue(key, &stored_value) && stored_value->GetAsInteger(value);
108 }
109
110 void PrefValueMap::SetInteger(const std::string& key, const int value) {
111 SetValue(key, Value::CreateIntegerValue(value));
112 }
113
105 void PrefValueMap::GetDifferingKeys( 114 void PrefValueMap::GetDifferingKeys(
106 const PrefValueMap* other, 115 const PrefValueMap* other,
107 std::vector<std::string>* differing_keys) const { 116 std::vector<std::string>* differing_keys) const {
108 differing_keys->clear(); 117 differing_keys->clear();
109 118
110 // Walk over the maps in lockstep, adding everything that is different. 119 // Walk over the maps in lockstep, adding everything that is different.
111 Map::const_iterator this_pref(prefs_.begin()); 120 Map::const_iterator this_pref(prefs_.begin());
112 Map::const_iterator other_pref(other->prefs_.begin()); 121 Map::const_iterator other_pref(other->prefs_.begin());
113 while (this_pref != prefs_.end() && other_pref != other->prefs_.end()) { 122 while (this_pref != prefs_.end() && other_pref != other->prefs_.end()) {
114 const int diff = this_pref->first.compare(other_pref->first); 123 const int diff = this_pref->first.compare(other_pref->first);
(...skipping 10 matching lines...) Expand all
125 ++other_pref; 134 ++other_pref;
126 } 135 }
127 } 136 }
128 137
129 // Add the remaining entries. 138 // Add the remaining entries.
130 for ( ; this_pref != prefs_.end(); ++this_pref) 139 for ( ; this_pref != prefs_.end(); ++this_pref)
131 differing_keys->push_back(this_pref->first); 140 differing_keys->push_back(this_pref->first);
132 for ( ; other_pref != other->prefs_.end(); ++other_pref) 141 for ( ; other_pref != other->prefs_.end(); ++other_pref)
133 differing_keys->push_back(other_pref->first); 142 differing_keys->push_back(other_pref->first);
134 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_value_map.h ('k') | chrome/browser/prefs/pref_value_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698