| 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/model_type_payload_map.h" | 13 #include "chrome/browser/sync/syncable/model_type_payload_map.h" |
| 14 #include "chrome/browser/sync/syncable/syncable.h" | 14 #include "chrome/browser/sync/syncable/syncable.h" |
| 15 #include "chrome/common/chrome_switches.h" | |
| 16 | 15 |
| 17 using sync_pb::DebugInfo; | 16 using sync_pb::DebugInfo; |
| 18 | 17 |
| 19 namespace browser_sync { | 18 namespace browser_sync { |
| 20 using sessions::StatusController; | 19 using sessions::StatusController; |
| 21 using sessions::SyncSession; | 20 using sessions::SyncSession; |
| 22 using std::string; | 21 using std::string; |
| 23 using syncable::FIRST_REAL_MODEL_TYPE; | 22 using syncable::FIRST_REAL_MODEL_TYPE; |
| 24 using syncable::MODEL_TYPE_COUNT; | 23 using syncable::MODEL_TYPE_COUNT; |
| 25 using syncable::ModelTypeSet; | 24 using syncable::ModelTypeSet; |
| 26 using syncable::ModelTypeSetToString; | 25 using syncable::ModelTypeSetToString; |
| 27 | 26 |
| 28 DownloadUpdatesCommand::DownloadUpdatesCommand() {} | 27 DownloadUpdatesCommand::DownloadUpdatesCommand( |
| 28 bool create_mobile_bookmarks_folder) |
| 29 : create_mobile_bookmarks_folder_(create_mobile_bookmarks_folder) {} |
| 30 |
| 29 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} | 31 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} |
| 30 | 32 |
| 31 SyncerError DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { | 33 SyncerError DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { |
| 32 ClientToServerMessage client_to_server_message; | 34 ClientToServerMessage client_to_server_message; |
| 33 ClientToServerResponse update_response; | 35 ClientToServerResponse update_response; |
| 34 | 36 |
| 35 client_to_server_message.set_share(session->context()->account_name()); | 37 client_to_server_message.set_share(session->context()->account_name()); |
| 36 client_to_server_message.set_message_contents( | 38 client_to_server_message.set_message_contents( |
| 37 ClientToServerMessage::GET_UPDATES); | 39 ClientToServerMessage::GET_UPDATES); |
| 38 GetUpdatesMessage* get_updates = | 40 GetUpdatesMessage* get_updates = |
| 39 client_to_server_message.mutable_get_updates(); | 41 client_to_server_message.mutable_get_updates(); |
| 40 if (CommandLine::ForCurrentProcess()->HasSwitch( | 42 get_updates->set_create_mobile_bookmarks_folder( |
| 41 switches::kCreateMobileBookmarksFolder)) { | 43 create_mobile_bookmarks_folder_); |
| 42 get_updates->set_include_syncable_bookmarks(true); | |
| 43 } | |
| 44 | 44 |
| 45 syncable::Directory* dir = session->context()->directory(); | 45 syncable::Directory* dir = session->context()->directory(); |
| 46 | 46 |
| 47 // Request updates for all enabled types. | 47 // Request updates for all enabled types. |
| 48 const ModelTypeSet enabled_types = | 48 const ModelTypeSet enabled_types = |
| 49 GetRoutingInfoTypes(session->routing_info()); | 49 GetRoutingInfoTypes(session->routing_info()); |
| 50 DVLOG(1) << "Getting updates for types " | 50 DVLOG(1) << "Getting updates for types " |
| 51 << ModelTypeSetToString(enabled_types); | 51 << ModelTypeSetToString(enabled_types); |
| 52 DCHECK(!enabled_types.Empty()); | 52 DCHECK(!enabled_types.Empty()); |
| 53 | 53 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if (session->context()->debug_info_getter()) { | 121 if (session->context()->debug_info_getter()) { |
| 122 session->context()->debug_info_getter()->GetAndClearDebugInfo( | 122 session->context()->debug_info_getter()->GetAndClearDebugInfo( |
| 123 debug_info); | 123 debug_info); |
| 124 } | 124 } |
| 125 session->mutable_status_controller()->set_debug_info_sent(); | 125 session->mutable_status_controller()->set_debug_info_sent(); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 } // namespace browser_sync | 130 } // namespace browser_sync |
| OLD | NEW |