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

Unified Diff: chrome/browser/sync/glue/generic_change_processor.cc

Issue 215973007: [Sync] Add plumbing of context from client to server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/sync/glue/generic_change_processor.cc
diff --git a/chrome/browser/sync/glue/generic_change_processor.cc b/chrome/browser/sync/glue/generic_change_processor.cc
index d2204eb70edbc5a52ddb332f5c2fb5598b80c787..194a5b4c57c158e92ecb47dd25e35e10eb762726 100644
--- a/chrome/browser/sync/glue/generic_change_processor.cc
+++ b/chrome/browser/sync/glue/generic_change_processor.cc
@@ -18,6 +18,7 @@
#include "sync/internal_api/public/util/unrecoverable_error_handler.h"
#include "sync/internal_api/public/write_node.h"
#include "sync/internal_api/public/write_transaction.h"
+#include "sync/syncable/directory.h"
#include "sync/syncable/entry.h" // TODO(tim): Bug 123674.
using content::BrowserThread;
@@ -153,7 +154,21 @@ syncer::SyncDataList GenericChangeProcessor::GetAllSyncData(
syncer::SyncError GenericChangeProcessor::UpdateDataTypeContext(
syncer::ModelType type,
const std::string& context) {
- NOTIMPLEMENTED();
+ syncer::WriteTransaction trans(FROM_HERE, share_handle());
+ sync_pb::DataTypeContext context_proto;
+ trans.GetDirectory()->GetDataTypeContext(type, &context_proto);
+
+ if (context_proto.context() == context)
+ return syncer::SyncError(); // Context already matches.
rlarocque 2014/04/03 17:31:58 Why is this an error? It seems harmless.
Nicolas Zea 2014/04/03 22:56:47 default-initialized SyncError aren't errors.
+
+ if (context_proto.type() == 0)
+ context_proto.set_type(syncer::GetSpecificsFieldNumberFromModelType(type));
+ DCHECK_EQ(syncer::GetSpecificsFieldNumberFromModelType(type),
+ context_proto.type());
+ DCHECK_GE(context_proto.version(), 0);
+ context_proto.set_version(context_proto.version() + 1);
+ context_proto.set_context(context);
+ trans.GetDirectory()->SetDataTypeContext(type, context_proto);
return syncer::SyncError();
}
« no previous file with comments | « no previous file | sync/engine/directory_commit_contribution.h » ('j') | sync/engine/directory_commit_contribution.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698