Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/engine/download_updates_command.h" | 5 #include "chrome/browser/sync/engine/download_updates_command.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/sync/engine/syncer.h" | 10 #include "chrome/browser/sync/engine/syncer.h" |
| 11 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 11 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
| 12 #include "chrome/browser/sync/engine/syncproto.h" | 12 #include "chrome/browser/sync/engine/syncproto.h" |
| 13 #include "chrome/browser/sync/syncable/directory_manager.h" | 13 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 14 #include "chrome/browser/sync/syncable/model_type_payload_map.h" | 14 #include "chrome/browser/sync/syncable/model_type_payload_map.h" |
| 15 #include "chrome/common/chrome_switches.h" | |
| 16 | 15 |
| 17 using syncable::ScopedDirLookup; | 16 using syncable::ScopedDirLookup; |
| 18 | 17 |
| 19 using sync_pb::DebugInfo; | 18 using sync_pb::DebugInfo; |
| 20 | 19 |
| 21 namespace browser_sync { | 20 namespace browser_sync { |
| 22 using sessions::StatusController; | 21 using sessions::StatusController; |
| 23 using sessions::SyncSession; | 22 using sessions::SyncSession; |
| 24 using std::string; | 23 using std::string; |
| 25 using syncable::FIRST_REAL_MODEL_TYPE; | 24 using syncable::FIRST_REAL_MODEL_TYPE; |
| 26 using syncable::MODEL_TYPE_COUNT; | 25 using syncable::MODEL_TYPE_COUNT; |
| 27 using syncable::ModelTypeSet; | 26 using syncable::ModelTypeSet; |
| 28 using syncable::ModelTypeSetToString; | 27 using syncable::ModelTypeSetToString; |
| 29 | 28 |
| 30 DownloadUpdatesCommand::DownloadUpdatesCommand() {} | 29 DownloadUpdatesCommand::DownloadUpdatesCommand( |
| 30 bool include_syncable_bookmarks) | |
| 31 : include_syncable_bookmarks_(include_syncable_bookmarks) {} | |
| 32 | |
| 31 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} | 33 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} |
| 32 | 34 |
| 33 SyncerError DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { | 35 SyncerError DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { |
| 34 ClientToServerMessage client_to_server_message; | 36 ClientToServerMessage client_to_server_message; |
| 35 ClientToServerResponse update_response; | 37 ClientToServerResponse update_response; |
| 36 | 38 |
| 37 client_to_server_message.set_share(session->context()->account_name()); | 39 client_to_server_message.set_share(session->context()->account_name()); |
| 38 client_to_server_message.set_message_contents( | 40 client_to_server_message.set_message_contents( |
| 39 ClientToServerMessage::GET_UPDATES); | 41 ClientToServerMessage::GET_UPDATES); |
| 40 GetUpdatesMessage* get_updates = | 42 GetUpdatesMessage* get_updates = |
| 41 client_to_server_message.mutable_get_updates(); | 43 client_to_server_message.mutable_get_updates(); |
| 42 if (CommandLine::ForCurrentProcess()->HasSwitch( | 44 get_updates->set_include_syncable_bookmarks(include_syncable_bookmarks_); |
|
Nicolas Zea
2012/02/27 20:03:12
So is this always included in the getupdates if it
akalin
2012/02/27 22:04:18
I don't think so. This was the behavior before bu
Yaron
2012/02/27 22:15:01
It's a misnomer. This flag tells the sync server t
| |
| 43 switches::kCreateMobileBookmarksFolder)) { | |
| 44 get_updates->set_include_syncable_bookmarks(true); | |
| 45 } | |
| 46 | 45 |
| 47 ScopedDirLookup dir(session->context()->directory_manager(), | 46 ScopedDirLookup dir(session->context()->directory_manager(), |
| 48 session->context()->account_name()); | 47 session->context()->account_name()); |
| 49 if (!dir.good()) { | 48 if (!dir.good()) { |
| 50 LOG(ERROR) << "Scoped dir lookup failed!"; | 49 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 51 return DIRECTORY_LOOKUP_FAILED; | 50 return DIRECTORY_LOOKUP_FAILED; |
| 52 } | 51 } |
| 53 | 52 |
| 54 // Request updates for all enabled types. | 53 // Request updates for all enabled types. |
| 55 const ModelTypeSet enabled_types = | 54 const ModelTypeSet enabled_types = |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 if (session->context()->debug_info_getter()) { | 127 if (session->context()->debug_info_getter()) { |
| 129 session->context()->debug_info_getter()->GetAndClearDebugInfo( | 128 session->context()->debug_info_getter()->GetAndClearDebugInfo( |
| 130 debug_info); | 129 debug_info); |
| 131 } | 130 } |
| 132 session->mutable_status_controller()->set_debug_info_sent(); | 131 session->mutable_status_controller()->set_debug_info_sent(); |
| 133 } | 132 } |
| 134 } | 133 } |
| 135 | 134 |
| 136 | 135 |
| 137 } // namespace browser_sync | 136 } // namespace browser_sync |
| OLD | NEW |