| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/syncer.h" | 10 #include "chrome/browser/sync/engine/syncer.h" |
| 10 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 11 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
| 11 #include "chrome/browser/sync/engine/syncproto.h" | 12 #include "chrome/browser/sync/engine/syncproto.h" |
| 12 #include "chrome/browser/sync/syncable/directory_manager.h" | 13 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 13 #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" |
| 14 | 16 |
| 15 using syncable::ScopedDirLookup; | 17 using syncable::ScopedDirLookup; |
| 16 | 18 |
| 17 using sync_pb::DebugInfo; | 19 using sync_pb::DebugInfo; |
| 18 | 20 |
| 19 namespace browser_sync { | 21 namespace browser_sync { |
| 20 using sessions::StatusController; | 22 using sessions::StatusController; |
| 21 using sessions::SyncSession; | 23 using sessions::SyncSession; |
| 22 using std::string; | 24 using std::string; |
| 23 using syncable::FIRST_REAL_MODEL_TYPE; | 25 using syncable::FIRST_REAL_MODEL_TYPE; |
| 24 using syncable::MODEL_TYPE_COUNT; | 26 using syncable::MODEL_TYPE_COUNT; |
| 25 | 27 |
| 26 DownloadUpdatesCommand::DownloadUpdatesCommand() {} | 28 DownloadUpdatesCommand::DownloadUpdatesCommand() {} |
| 27 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} | 29 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} |
| 28 | 30 |
| 29 void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { | 31 void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { |
| 30 ClientToServerMessage client_to_server_message; | 32 ClientToServerMessage client_to_server_message; |
| 31 ClientToServerResponse update_response; | 33 ClientToServerResponse update_response; |
| 32 | 34 |
| 33 client_to_server_message.set_share(session->context()->account_name()); | 35 client_to_server_message.set_share(session->context()->account_name()); |
| 34 client_to_server_message.set_message_contents( | 36 client_to_server_message.set_message_contents( |
| 35 ClientToServerMessage::GET_UPDATES); | 37 ClientToServerMessage::GET_UPDATES); |
| 36 GetUpdatesMessage* get_updates = | 38 GetUpdatesMessage* get_updates = |
| 37 client_to_server_message.mutable_get_updates(); | 39 client_to_server_message.mutable_get_updates(); |
| 38 // TODO: make this default to true. | 40 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 39 get_updates->set_include_syncable_bookmarks(true); | 41 switches::kCreateMobileBookmarksFolder)) { |
| 42 get_updates->set_include_syncable_bookmarks(true); |
| 43 } |
| 40 | 44 |
| 41 ScopedDirLookup dir(session->context()->directory_manager(), | 45 ScopedDirLookup dir(session->context()->directory_manager(), |
| 42 session->context()->account_name()); | 46 session->context()->account_name()); |
| 43 if (!dir.good()) { | 47 if (!dir.good()) { |
| 44 LOG(ERROR) << "Scoped dir lookup failed!"; | 48 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 45 return; | 49 return; |
| 46 } | 50 } |
| 47 | 51 |
| 48 // Request updates for all enabled types. | 52 // Request updates for all enabled types. |
| 49 syncable::ModelTypeBitSet enabled_types; | 53 syncable::ModelTypeBitSet enabled_types; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (session->context()->debug_info_getter()) { | 126 if (session->context()->debug_info_getter()) { |
| 123 session->context()->debug_info_getter()->GetAndClearDebugInfo( | 127 session->context()->debug_info_getter()->GetAndClearDebugInfo( |
| 124 debug_info); | 128 debug_info); |
| 125 } | 129 } |
| 126 session->mutable_status_controller()->set_debug_info_sent(); | 130 session->mutable_status_controller()->set_debug_info_sent(); |
| 127 } | 131 } |
| 128 } | 132 } |
| 129 | 133 |
| 130 | 134 |
| 131 } // namespace browser_sync | 135 } // namespace browser_sync |
| OLD | NEW |