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

Unified Diff: components/autofill/core/browser/webdata/autofill_metadata_change_list.cc

Issue 2624883002: [Sync] ApplySyncChanges autofill implementation. (Closed)
Patch Set: More updates for Max's comments. Created 3 years, 11 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
« no previous file with comments | « components/autofill/core/browser/webdata/autofill_metadata_change_list.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/webdata/autofill_metadata_change_list.cc
diff --git a/components/autofill/core/browser/webdata/autofill_metadata_change_list.cc b/components/autofill/core/browser/webdata/autofill_metadata_change_list.cc
index 5126c27de142f67ca7340b1d26640b5a74b38444..24876e4a0cff1b7dd51b5dec518717e20ec9dae8 100644
--- a/components/autofill/core/browser/webdata/autofill_metadata_change_list.cc
+++ b/components/autofill/core/browser/webdata/autofill_metadata_change_list.cc
@@ -6,7 +6,8 @@
#include "base/location.h"
-using syncer::SyncError;
+using base::Optional;
+using syncer::ModelError;
namespace autofill {
@@ -19,60 +20,56 @@ AutofillMetadataChangeList::AutofillMetadataChangeList(AutofillTable* table,
}
AutofillMetadataChangeList::~AutofillMetadataChangeList() {
- DCHECK(!error_.IsSet());
+ DCHECK(!error_);
}
void AutofillMetadataChangeList::UpdateModelTypeState(
const sync_pb::ModelTypeState& model_type_state) {
- if (error_.IsSet()) {
+ if (error_) {
return;
}
if (!table_->UpdateModelTypeState(type_, model_type_state)) {
- error_ = SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
- "Failed to update ModelTypeState.", type_);
+ error_ = ModelError(FROM_HERE, "Failed to update ModelTypeState.");
}
}
void AutofillMetadataChangeList::ClearModelTypeState() {
- if (error_.IsSet()) {
+ if (error_) {
return;
}
if (!table_->ClearModelTypeState(type_)) {
- error_ = SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
- "Failed to clear ModelTypeState.", type_);
+ error_ = ModelError(FROM_HERE, "Failed to clear ModelTypeState.");
}
}
void AutofillMetadataChangeList::UpdateMetadata(
const std::string& storage_key,
const sync_pb::EntityMetadata& metadata) {
- if (error_.IsSet()) {
+ if (error_) {
return;
}
if (!table_->UpdateSyncMetadata(type_, storage_key, metadata)) {
- error_ = SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
- "Failed to update entity metadata.", type_);
+ error_ = ModelError(FROM_HERE, "Failed to update entity metadata.");
}
}
void AutofillMetadataChangeList::ClearMetadata(const std::string& storage_key) {
- if (error_.IsSet()) {
+ if (error_) {
return;
}
if (!table_->ClearSyncMetadata(type_, storage_key)) {
- error_ = SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
- "Failed to clear entity metadata.", type_);
+ error_ = ModelError(FROM_HERE, "Failed to clear entity metadata.");
}
}
-SyncError AutofillMetadataChangeList::TakeError() {
- SyncError e = error_;
- error_ = SyncError();
- return e;
+Optional<ModelError> AutofillMetadataChangeList::TakeError() {
+ Optional<ModelError> temp = error_;
+ error_.reset();
+ return temp;
}
} // namespace autofill
« no previous file with comments | « components/autofill/core/browser/webdata/autofill_metadata_change_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698