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 namespace browser_sync { | 19 namespace browser_sync { |
18 using sessions::StatusController; | 20 using sessions::StatusController; |
19 using sessions::SyncSession; | 21 using sessions::SyncSession; |
20 using std::string; | 22 using std::string; |
21 using syncable::FIRST_REAL_MODEL_TYPE; | 23 using syncable::FIRST_REAL_MODEL_TYPE; |
22 using syncable::MODEL_TYPE_COUNT; | 24 using syncable::MODEL_TYPE_COUNT; |
23 | 25 |
24 DownloadUpdatesCommand::DownloadUpdatesCommand() {} | 26 DownloadUpdatesCommand::DownloadUpdatesCommand() {} |
25 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} | 27 DownloadUpdatesCommand::~DownloadUpdatesCommand() {} |
26 | 28 |
27 void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { | 29 void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { |
28 ClientToServerMessage client_to_server_message; | 30 ClientToServerMessage client_to_server_message; |
29 ClientToServerResponse update_response; | 31 ClientToServerResponse update_response; |
30 | 32 |
31 client_to_server_message.set_share(session->context()->account_name()); | 33 client_to_server_message.set_share(session->context()->account_name()); |
32 client_to_server_message.set_message_contents( | 34 client_to_server_message.set_message_contents( |
33 ClientToServerMessage::GET_UPDATES); | 35 ClientToServerMessage::GET_UPDATES); |
34 GetUpdatesMessage* get_updates = | 36 GetUpdatesMessage* get_updates = |
35 client_to_server_message.mutable_get_updates(); | 37 client_to_server_message.mutable_get_updates(); |
| 38 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 39 switches::kEnableSyncedBookmarksFolder)) { |
| 40 get_updates->set_include_syncable_bookmarks(true); |
| 41 } |
36 | 42 |
37 ScopedDirLookup dir(session->context()->directory_manager(), | 43 ScopedDirLookup dir(session->context()->directory_manager(), |
38 session->context()->account_name()); | 44 session->context()->account_name()); |
39 if (!dir.good()) { | 45 if (!dir.good()) { |
40 LOG(ERROR) << "Scoped dir lookup failed!"; | 46 LOG(ERROR) << "Scoped dir lookup failed!"; |
41 return; | 47 return; |
42 } | 48 } |
43 | 49 |
44 // Request updates for all enabled types. | 50 // Request updates for all enabled types. |
45 syncable::ModelTypeBitSet enabled_types; | 51 syncable::ModelTypeBitSet enabled_types; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 if (target_datatypes[i]) { | 120 if (target_datatypes[i]) { |
115 requested_type_count++; | 121 requested_type_count++; |
116 syncable::AddDefaultExtensionValue(syncable::ModelTypeFromInt(i), | 122 syncable::AddDefaultExtensionValue(syncable::ModelTypeFromInt(i), |
117 filter_protobuf); | 123 filter_protobuf); |
118 } | 124 } |
119 } | 125 } |
120 DCHECK_LT(0, requested_type_count) << "Doing GetUpdates with empty filter."; | 126 DCHECK_LT(0, requested_type_count) << "Doing GetUpdates with empty filter."; |
121 } | 127 } |
122 | 128 |
123 } // namespace browser_sync | 129 } // namespace browser_sync |
OLD | NEW |