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(); |
} |