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

Unified Diff: chrome/browser/extensions/settings/syncable_settings_storage.cc

Issue 8501036: Convert extensions code using DictionaryValue::key_iterator and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/settings/syncable_settings_storage.cc
diff --git a/chrome/browser/extensions/settings/syncable_settings_storage.cc b/chrome/browser/extensions/settings/syncable_settings_storage.cc
index 5cfb4ec2c82b6a01ca99f7b20e8b5f2435dd0d8d..613904f1970b43cd8eab88e0bf660cb19fdfbf05 100644
--- a/chrome/browser/extensions/settings/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/settings/syncable_settings_storage.cc
@@ -148,12 +148,9 @@ SyncError SyncableSettingsStorage::SendLocalSettingsToSync(
DCHECK(sync_processor_);
SyncChangeList changes;
- for (DictionaryValue::key_iterator it = settings.begin_keys();
- it != settings.end_keys(); ++it) {
- Value* value;
- settings.GetWithoutPathExpansion(*it, &value);
+ for (DictionaryValue::Iterator it(settings); it.HasNext(); it.Advance()) {
changes.push_back(
- settings_sync_util::CreateAdd(extension_id_, *it, *value));
+ settings_sync_util::CreateAdd(extension_id_, it.key(), it.value()));
}
if (changes.empty()) {
@@ -181,23 +178,21 @@ SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
scoped_ptr<DictionaryValue> new_sync_state(sync_state.DeepCopy());
SettingSyncDataList changes;
- for (DictionaryValue::key_iterator it = settings.begin_keys();
- it != settings.end_keys(); ++it) {
+ for (DictionaryValue::Iterator it(settings); it.HasNext(); it.Advance()) {
Value* orphaned_sync_value = NULL;
- if (new_sync_state->RemoveWithoutPathExpansion(*it, &orphaned_sync_value)) {
+ if (new_sync_state->RemoveWithoutPathExpansion(
+ it.key(), &orphaned_sync_value)) {
scoped_ptr<Value> sync_value(orphaned_sync_value);
- Value* local_value = NULL;
- settings.GetWithoutPathExpansion(*it, &local_value);
- if (sync_value->Equals(local_value)) {
+ if (sync_value->Equals(&it.value())) {
// Sync and local values are the same, no changes to send.
- synced_keys_.insert(*it);
+ synced_keys_.insert(it.key());
} else {
// Sync value is different, update local setting with new value.
changes.push_back(
SettingSyncData(
SyncChange::ACTION_UPDATE,
extension_id_,
- *it,
+ it.key(),
sync_value.release()));
}
} else {
@@ -206,7 +201,7 @@ SyncError SyncableSettingsStorage::OverwriteLocalSettingsWithSync(
SettingSyncData(
SyncChange::ACTION_DELETE,
extension_id_,
- *it,
+ it.key(),
new DictionaryValue()));
}
}
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698