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