diff options
author | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 01:05:38 +0000 |
---|---|---|
committer | nick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 01:05:38 +0000 |
commit | f753af6865f1724c3e5adde6917bb2b1f24713ce (patch) | |
tree | 35a5185cbadcbf66625fb438f893bba4e806ef68 /chrome/browser/sync/engine/download_updates_command.cc | |
parent | 3d8a66ab748a0bcb5126b1466d311ad62db4d94d (diff) | |
download | chromium_src-f753af6865f1724c3e5adde6917bb2b1f24713ce.zip chromium_src-f753af6865f1724c3e5adde6917bb2b1f24713ce.tar.gz chromium_src-f753af6865f1724c3e5adde6917bb2b1f24713ce.tar.bz2 |
Hook up client side of per-datatype GetUpdates.
Which datatypes are fetched is dictated by the ModelSafeRoutingInfo. We change the semantic of the ModelSafeRoutingInfo so that datatypes which should not be synced are not in the map. We will do GetUpdates for GROUP_PASSIVE datatypes.
BUG=29905
TEST=included unit tests
Review URL: http://codereview.chromium.org/594024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38726 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/engine/download_updates_command.cc')
-rw-r--r-- | chrome/browser/sync/engine/download_updates_command.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/sync/engine/download_updates_command.cc b/chrome/browser/sync/engine/download_updates_command.cc index 9b75ec2..cc58874 100644 --- a/chrome/browser/sync/engine/download_updates_command.cc +++ b/chrome/browser/sync/engine/download_updates_command.cc @@ -42,6 +42,15 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { LOG(INFO) << "Getting updates from ts " << dir->last_sync_timestamp(); get_updates->set_from_timestamp(dir->last_sync_timestamp()); + // We want folders for our associated types, always. If we were to set + // this to false, the server would send just the non-container items + // (e.g. Bookmark URLs but not their containing folders). + get_updates->set_fetch_folders(true); + + // Set the requested_types protobuf field so that we fetch all enabled types. + SetRequestedTypes(session->routing_info(), + get_updates->mutable_requested_types()); + // Set GetUpdatesMessage.GetUpdatesCallerInfo information. get_updates->mutable_caller_info()->set_source(session->TestAndSetSource()); get_updates->mutable_caller_info()->set_notifications_enabled( @@ -62,4 +71,20 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { status->mutable_updates_response()->CopyFrom(update_response); } +void DownloadUpdatesCommand::SetRequestedTypes( + const ModelSafeRoutingInfo& routing_info, + sync_pb::EntitySpecifics* types) { + // The datatypes which should be synced are dictated by the value of the + // ModelSafeRoutingInfo. If a datatype is in the routing info map, it + // should be synced (even if it's GROUP_PASSIVE). + int requested_type_count = 0; + for (ModelSafeRoutingInfo::const_iterator i = routing_info.begin(); + i != routing_info.end(); + ++i) { + requested_type_count++; + syncable::AddDefaultExtensionValue(i->first, types); + } + DCHECK_LT(0, requested_type_count) << "Doing GetUpdates with empty filter."; +} + } // namespace browser_sync |