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

Unified Diff: chrome/browser/extensions/api/storage/syncable_settings_storage.cc

Issue 24021002: Propagate more information about ValueStore errors to callers, notably an (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add Pass*() Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/storage/syncable_settings_storage.cc
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
index b2f5742883005b903e3db9b099824d3e3d282325..fbfa0786a0ef4d963305a9d0d52107f6af70e224 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h"
+#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/api/storage/settings_namespace.h"
#include "chrome/browser/extensions/api/storage/settings_sync_processor.h"
#include "chrome/browser/extensions/api/storage/settings_sync_util.h"
@@ -142,15 +143,15 @@ syncer::SyncError SyncableSettingsStorage::StartSyncing(
return syncer::SyncError(
FROM_HERE,
syncer::SyncError::DATATYPE_ERROR,
- std::string("Failed to get settings: ") + maybe_settings->error(),
+ base::StringPrintf("Failed to get settings: %s",
+ maybe_settings->error().message.c_str()),
sync_processor_->type());
}
- const base::DictionaryValue& settings = *maybe_settings->settings().get();
- if (sync_state.empty())
- return SendLocalSettingsToSync(settings);
- else
- return OverwriteLocalSettingsWithSync(sync_state, settings);
+ const base::DictionaryValue& settings = maybe_settings->settings();
+ return sync_state.empty() ?
+ SendLocalSettingsToSync(settings) :
+ OverwriteLocalSettingsWithSync(sync_state, settings);
}
syncer::SyncError SyncableSettingsStorage::SendLocalSettingsToSync(
@@ -261,15 +262,14 @@ syncer::SyncError SyncableSettingsStorage::ProcessSyncChanges(
errors.push_back(syncer::SyncError(
FROM_HERE,
syncer::SyncError::DATATYPE_ERROR,
- std::string("Error getting current sync state for ") +
- extension_id_ + "/" + key + ": " + maybe_settings->error(),
+ base::StringPrintf("Error getting current sync state for %s/%s: %s",
+ extension_id_.c_str(), key.c_str(),
+ maybe_settings->error().message.c_str()),
sync_processor_->type()));
continue;
}
- Value* value = NULL;
- if (maybe_settings->settings()->GetWithoutPathExpansion(key, &value)) {
- current_value.reset(value->DeepCopy());
- }
+ maybe_settings->settings().RemoveWithoutPathExpansion(key,
+ &current_value);
}
syncer::SyncError error;
@@ -341,8 +341,8 @@ syncer::SyncError SyncableSettingsStorage::OnSyncAdd(
return syncer::SyncError(
FROM_HERE,
syncer::SyncError::DATATYPE_ERROR,
- std::string("Error pushing sync add to local settings: ") +
- result->error(),
+ base::StringPrintf("Error pushing sync add to local settings: %s",
+ result->error().message.c_str()),
sync_processor_->type());
}
changes->push_back(ValueStoreChange(key, NULL, new_value));
@@ -361,8 +361,8 @@ syncer::SyncError SyncableSettingsStorage::OnSyncUpdate(
return syncer::SyncError(
FROM_HERE,
syncer::SyncError::DATATYPE_ERROR,
- std::string("Error pushing sync update to local settings: ") +
- result->error(),
+ base::StringPrintf("Error pushing sync update to local settings: %s",
+ result->error().message.c_str()),
sync_processor_->type());
}
changes->push_back(ValueStoreChange(key, old_value, new_value));
@@ -379,8 +379,8 @@ syncer::SyncError SyncableSettingsStorage::OnSyncDelete(
return syncer::SyncError(
FROM_HERE,
syncer::SyncError::DATATYPE_ERROR,
- std::string("Error pushing sync remove to local settings: ") +
- result->error(),
+ base::StringPrintf("Error pushing sync remove to local settings: %s",
+ result->error().message.c_str()),
sync_processor_->type());
}
changes->push_back(ValueStoreChange(key, old_value, NULL));

Powered by Google App Engine
This is Rietveld 408576698