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

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

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 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
« no previous file with comments | « chrome/browser/policy/policy_loader_win.cc ('k') | chrome/browser/printing/print_job_worker.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_model_associator.h" 5 #include "chrome/browser/prefs/pref_model_associator.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 DCHECK_EQ(from_value.GetType(), Value::TYPE_DICTIONARY); 247 DCHECK_EQ(from_value.GetType(), Value::TYPE_DICTIONARY);
248 DCHECK_EQ(to_value.GetType(), Value::TYPE_DICTIONARY); 248 DCHECK_EQ(to_value.GetType(), Value::TYPE_DICTIONARY);
249 const DictionaryValue& from_dict_value = 249 const DictionaryValue& from_dict_value =
250 static_cast<const DictionaryValue&>(from_value); 250 static_cast<const DictionaryValue&>(from_value);
251 const DictionaryValue& to_dict_value = 251 const DictionaryValue& to_dict_value =
252 static_cast<const DictionaryValue&>(to_value); 252 static_cast<const DictionaryValue&>(to_value);
253 DictionaryValue* result = to_dict_value.DeepCopy(); 253 DictionaryValue* result = to_dict_value.DeepCopy();
254 254
255 for (DictionaryValue::key_iterator key = from_dict_value.begin_keys(); 255 for (DictionaryValue::key_iterator key = from_dict_value.begin_keys();
256 key != from_dict_value.end_keys(); ++key) { 256 key != from_dict_value.end_keys(); ++key) {
257 Value* from_value; 257 const Value* from_value;
258 bool success = from_dict_value.GetWithoutPathExpansion(*key, &from_value); 258 bool success = from_dict_value.GetWithoutPathExpansion(*key, &from_value);
259 DCHECK(success); 259 DCHECK(success);
260 260
261 Value* to_key_value; 261 Value* to_key_value;
262 if (result->GetWithoutPathExpansion(*key, &to_key_value)) { 262 if (result->GetWithoutPathExpansion(*key, &to_key_value)) {
263 if (to_key_value->GetType() == Value::TYPE_DICTIONARY) { 263 if (to_key_value->GetType() == Value::TYPE_DICTIONARY) {
264 Value* merged_value = MergeDictionaryValues(*from_value, *to_key_value); 264 Value* merged_value = MergeDictionaryValues(*from_value, *to_key_value);
265 result->SetWithoutPathExpansion(*key, merged_value); 265 result->SetWithoutPathExpansion(*key, merged_value);
266 } 266 }
267 // Note that for all other types we want to preserve the "to" 267 // Note that for all other types we want to preserve the "to"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 } 438 }
439 439
440 syncer::SyncError error = 440 syncer::SyncError error =
441 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); 441 sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
442 } 442 }
443 443
444 void PrefModelAssociator::SetPrefService(PrefService* pref_service) { 444 void PrefModelAssociator::SetPrefService(PrefService* pref_service) {
445 DCHECK(pref_service_ == NULL); 445 DCHECK(pref_service_ == NULL);
446 pref_service_ = pref_service; 446 pref_service_ = pref_service;
447 } 447 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_loader_win.cc ('k') | chrome/browser/printing/print_job_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698