Index: sync/engine/get_updates_processor.cc |
diff --git a/sync/engine/get_updates_processor.cc b/sync/engine/get_updates_processor.cc |
index eb1d7be2e82987f9cff188b52a485e0f260421d7..d94f12cfa82ab5858e5bf444e92cd2419031e730 100644 |
--- a/sync/engine/get_updates_processor.cc |
+++ b/sync/engine/get_updates_processor.cc |
@@ -178,7 +178,13 @@ void GetUpdatesProcessor::PrepareGetUpdates( |
get_updates->add_from_progress_marker(); |
handler_it->second->GetDownloadProgress(progress_marker); |
progress_marker->clear_gc_directive(); |
+ |
+ sync_pb::DataTypeContext context; |
+ handler_it->second->GetDataTypeContext(&context); |
+ if (!context.context().empty()) |
+ get_updates->add_client_contexts()->Swap(&context); |
} |
+ |
delegate_.HelpPopulateGuMessage(get_updates); |
} |
@@ -314,6 +320,28 @@ bool GetUpdatesProcessor::ProcessGetUpdatesResponse( |
DCHECK(progress_marker_iter == progress_index_by_type.end() && |
updates_iter == updates_by_type.end()); |
+ for (int i = 0; i < gu_response.context_mutations_size(); ++i) { |
+ const sync_pb::DataTypeContext& context = gu_response.context_mutations(i); |
+ syncer::ModelType type = |
+ GetModelTypeFromSpecificsFieldNumber(context.type()); |
+ if (!syncer::IsRealDataType(type)) { |
+ DLOG(WARNING) << "Received datatype context mutation with invalid type."; |
+ continue; |
+ } |
+ |
+ UpdateHandlerMap::iterator update_handler_iter = |
+ update_handler_map_->find(type); |
+ |
+ if (update_handler_iter != update_handler_map_->end()) { |
+ update_handler_iter->second->ProcessDataTypeContextMutation(context); |
+ } else { |
+ DLOG(WARNING) |
+ << "Ignoring received context mutations of a type we can't handle. " |
+ << "Type is: " << ModelTypeToString(type); |
+ continue; |
+ } |
+ } |
+ |
return true; |
} |