diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 22:22:45 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 22:22:45 +0000 |
commit | 19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804 (patch) | |
tree | 5c117162a391159273bce2cff213b4a6cb3cbbd6 /sync | |
parent | 1ba12253ff4b32c75f9cebe2b69926f1cb815095 (diff) | |
download | chromium_src-19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804.zip chromium_src-19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804.tar.gz chromium_src-19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804.tar.bz2 |
[Sync] Add support for denoting which sessions types are enabled
We do this by sending the set of enabled types (those in the routing info) at
commit time via a new ClientConfigParams message.
BUG=170162
R=tim@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11935002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r-- | sync/engine/build_commit_command.cc | 12 | ||||
-rw-r--r-- | sync/engine/build_commit_command.h | 5 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.cc | 8 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.h | 4 | ||||
-rw-r--r-- | sync/protocol/sync.proto | 13 |
5 files changed, 42 insertions, 0 deletions
diff --git a/sync/engine/build_commit_command.cc b/sync/engine/build_commit_command.cc index 9d1a4b9..ba356e8 100644 --- a/sync/engine/build_commit_command.cc +++ b/sync/engine/build_commit_command.cc @@ -97,6 +97,17 @@ void BuildCommitCommand::AddExtensionsActivityToMessage( } } +void BuildCommitCommand::AddClientConfigParamsToMessage( + SyncSession* session, sync_pb::CommitMessage* message) { + const ModelSafeRoutingInfo& routing_info = session->routing_info(); + sync_pb::ClientConfigParams* config_params = message->mutable_config_params(); + for (std::map<ModelType, ModelSafeGroup>::const_iterator iter = + routing_info.begin(); iter != routing_info.end(); ++iter) { + int field_number = GetSpecificsFieldNumberFromModelType(iter->first); + config_params->mutable_enabled_type_ids()->Add(field_number); + } +} + namespace { void SetEntrySpecifics(MutableEntry* meta_entry, sync_pb::SyncEntity* sync_entry) { @@ -116,6 +127,7 @@ SyncerError BuildCommitCommand::ExecuteImpl(SyncSession* session) { commit_message->set_cache_guid( session->write_transaction()->directory()->cache_guid()); AddExtensionsActivityToMessage(session, commit_message); + AddClientConfigParamsToMessage(session, commit_message); // Cache previously computed position values. Because |commit_ids| // is already in sibling order, we should always hit this map after diff --git a/sync/engine/build_commit_command.h b/sync/engine/build_commit_command.h index b4190ca..253b6c0 100644 --- a/sync/engine/build_commit_command.h +++ b/sync/engine/build_commit_command.h @@ -53,6 +53,11 @@ class SYNC_EXPORT_PRIVATE BuildCommitCommand : public SyncerCommand { void AddExtensionsActivityToMessage(sessions::SyncSession* session, sync_pb::CommitMessage* message); + + // Fills the config_params field of |message|. + void AddClientConfigParamsToMessage(sessions::SyncSession* session, + sync_pb::CommitMessage* message); + // Helper for computing position. Find the numeric position value // of the closest already-synced entry. |direction| must be one of // NEXT_ID or PREV_ID; this parameter controls the search direction. diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index 97a989d..f0ddf21 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -539,6 +539,7 @@ DictionaryValue* CommitMessageToValue( SyncEntitiesToValue(proto.entries(), include_specifics)); SET_STR(cache_guid); SET_REP(extensions_activity, ChromiumExtensionActivityToValue); + SET(config_params, ClientConfigParamsToValue); return value; } @@ -721,6 +722,13 @@ base::DictionaryValue* SyncCycleCompletedEventInfoToValue( return value; } +base::DictionaryValue* ClientConfigParamsToValue( + const sync_pb::ClientConfigParams& proto) { + DictionaryValue* value = new DictionaryValue(); + SET_INT32_REP(enabled_type_ids); + return value; +} + #undef SET #undef SET_REP diff --git a/sync/protocol/proto_value_conversions.h b/sync/protocol/proto_value_conversions.h index 9003194..b3f3737 100644 --- a/sync/protocol/proto_value_conversions.h +++ b/sync/protocol/proto_value_conversions.h @@ -21,6 +21,7 @@ class AppSpecifics; class AutofillProfileSpecifics; class AutofillSpecifics; class BookmarkSpecifics; +class ClientConfigParams; class ClientToServerMessage; class ClientToServerResponse; class DatatypeAssociationStats; @@ -205,6 +206,9 @@ base::DictionaryValue* DebugInfoToValue( base::DictionaryValue* SyncCycleCompletedEventInfoToValue( const sync_pb::SyncCycleCompletedEventInfo& proto); +base::DictionaryValue* ClientConfigParamsToValue( + const sync_pb::ClientConfigParams& proto); + } // namespace syncer #endif // SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_ diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto index 0dafdc4..1c4f23c 100644 --- a/sync/protocol/sync.proto +++ b/sync/protocol/sync.proto @@ -362,6 +362,12 @@ message ChromiumExtensionsActivity { optional uint32 bookmark_writes_since_last_commit = 2; }; +// Client specific configuration information. +message ClientConfigParams { + // The set of data types this client has enabled. + repeated int32 enabled_type_ids = 1; +}; + message CommitMessage { repeated SyncEntity entries = 1; @@ -370,6 +376,13 @@ message CommitMessage { optional string cache_guid = 2; repeated ChromiumExtensionsActivity extensions_activity = 3; + + // The configuration of this client at commit time. Used by the server to + // make commit-time decisions about how to process datatypes that might + // involve server-side interaction, and e.g require explicit user intent for + // syncing a particular data type regardless of whether a commit for that + // datatype is currently being sent up. + optional ClientConfigParams config_params = 4; }; message DataTypeProgressMarker { |