OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef SYNC_ENGINE_DOWNLOAD_H_ | 5 #ifndef SYNC_ENGINE_DOWNLOAD_H_ |
6 #define SYNC_ENGINE_DOWNLOAD_H_ | 6 #define SYNC_ENGINE_DOWNLOAD_H_ |
7 | 7 |
8 #include "sync/base/sync_export.h" | 8 #include "sync/base/sync_export.h" |
9 #include "sync/engine/sync_directory_update_handler.h" | 9 #include "sync/engine/get_updates_processor.h" |
10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
11 #include "sync/internal_api/public/util/syncer_error.h" | 11 #include "sync/internal_api/public/util/syncer_error.h" |
12 #include "sync/protocol/sync.pb.h" | 12 #include "sync/protocol/sync.pb.h" |
13 | 13 |
14 namespace sync_pb { | 14 namespace sync_pb { |
15 class DebugInfo; | 15 class DebugInfo; |
16 } // namespace sync_pb | 16 } // namespace sync_pb |
17 | 17 |
18 namespace syncer { | 18 namespace syncer { |
19 | 19 |
20 namespace sessions { | 20 namespace sessions { |
21 class DebugInfoGetter; | 21 class DebugInfoGetter; |
22 class NudgeTracker; | 22 class NudgeTracker; |
23 class StatusController; | 23 class StatusController; |
24 class SyncSession; | 24 class SyncSession; |
25 } // namespace sessions | 25 } // namespace sessions |
26 | 26 |
27 namespace download { | 27 namespace download { |
28 | 28 |
29 // This function executes a single GetUpdate request and stores the response in | 29 // This function executes a single GetUpdate request and stores the response in |
30 // the session's StatusController. It constructs the type of request used to | 30 // the session's StatusController. It constructs the type of request used to |
31 // keep types in sync when in normal mode. | 31 // keep types in sync when in normal mode. |
32 SYNC_EXPORT_PRIVATE void BuildNormalDownloadUpdates( | 32 SYNC_EXPORT_PRIVATE void BuildNormalDownloadUpdates( |
33 sessions::SyncSession* session, | 33 sessions::SyncSession* session, |
| 34 GetUpdatesProcessor* get_updates_processor, |
34 bool create_mobile_bookmarks_folder, | 35 bool create_mobile_bookmarks_folder, |
35 ModelTypeSet request_types, | 36 ModelTypeSet request_types, |
36 const sessions::NudgeTracker& nudge_tracker, | 37 const sessions::NudgeTracker& nudge_tracker, |
37 sync_pb::ClientToServerMessage* client_to_server_message); | 38 sync_pb::ClientToServerMessage* client_to_server_message); |
38 | 39 |
39 // Helper function. Defined here for testing. | 40 // Helper function. Defined here for testing. |
40 SYNC_EXPORT_PRIVATE void BuildNormalDownloadUpdatesImpl( | 41 SYNC_EXPORT_PRIVATE void BuildNormalDownloadUpdatesImpl( |
41 ModelTypeSet proto_request_types, | 42 ModelTypeSet proto_request_types, |
42 UpdateHandlerMap* update_handler_map, | 43 GetUpdatesProcessor* get_updates_processor, |
43 const sessions::NudgeTracker& nudge_tracker, | 44 const sessions::NudgeTracker& nudge_tracker, |
44 sync_pb::GetUpdatesMessage* get_updates); | 45 sync_pb::GetUpdatesMessage* get_updates); |
45 | 46 |
46 // This function executes a single GetUpdate request and stores the response in | 47 // This function executes a single GetUpdate request and stores the response in |
47 // the session's StatusController. It constructs the type of request used to | 48 // the session's StatusController. It constructs the type of request used to |
48 // initialize a type for the first time. | 49 // initialize a type for the first time. |
49 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForConfigure( | 50 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForConfigure( |
50 sessions::SyncSession* session, | 51 sessions::SyncSession* session, |
| 52 GetUpdatesProcessor* get_updates_processor, |
51 bool create_mobile_bookmarks_folder, | 53 bool create_mobile_bookmarks_folder, |
52 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 54 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
53 ModelTypeSet request_types, | 55 ModelTypeSet request_types, |
54 sync_pb::ClientToServerMessage* client_to_server_message); | 56 sync_pb::ClientToServerMessage* client_to_server_message); |
55 | 57 |
56 // Helper function. Defined here for testing. | 58 // Helper function. Defined here for testing. |
57 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForConfigureImpl( | 59 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForConfigureImpl( |
58 ModelTypeSet proto_request_types, | 60 ModelTypeSet proto_request_types, |
59 UpdateHandlerMap* update_handler_map, | 61 GetUpdatesProcessor* get_updates_processor, |
60 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, | 62 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, |
61 sync_pb::GetUpdatesMessage* get_updates); | 63 sync_pb::GetUpdatesMessage* get_updates); |
62 | 64 |
63 // This function executes a single GetUpdate request and stores the response in | 65 // This function executes a single GetUpdate request and stores the response in |
64 // the session's status controller. It constructs the type of request used for | 66 // the session's status controller. It constructs the type of request used for |
65 // periodic polling. | 67 // periodic polling. |
66 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForPoll( | 68 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForPoll( |
67 sessions::SyncSession* session, | 69 sessions::SyncSession* session, |
| 70 GetUpdatesProcessor* get_updates_processor, |
68 bool create_mobile_bookmarks_folder, | 71 bool create_mobile_bookmarks_folder, |
69 ModelTypeSet request_types, | 72 ModelTypeSet request_types, |
70 sync_pb::ClientToServerMessage* client_to_server_message); | 73 sync_pb::ClientToServerMessage* client_to_server_message); |
71 | 74 |
72 // Helper function. Defined here for testing. | 75 // Helper function. Defined here for testing. |
73 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForPollImpl( | 76 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForPollImpl( |
74 ModelTypeSet proto_request_types, | 77 ModelTypeSet proto_request_types, |
75 UpdateHandlerMap* update_handler_map, | 78 GetUpdatesProcessor* get_updates_processor, |
76 sync_pb::GetUpdatesMessage* get_updates); | 79 sync_pb::GetUpdatesMessage* get_updates); |
77 | 80 |
78 // Same as BuildDownloadUpdatesForPoll() except the update origin/source is | 81 // Same as BuildDownloadUpdatesForPoll() except the update origin/source is |
79 // RETRY. | 82 // RETRY. |
80 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForRetry( | 83 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForRetry( |
81 sessions::SyncSession* session, | 84 sessions::SyncSession* session, |
| 85 GetUpdatesProcessor* get_updates_processor, |
82 bool create_mobile_bookmarks_folder, | 86 bool create_mobile_bookmarks_folder, |
83 ModelTypeSet request_types, | 87 ModelTypeSet request_types, |
84 sync_pb::ClientToServerMessage* client_to_server_message); | 88 sync_pb::ClientToServerMessage* client_to_server_message); |
85 | 89 |
86 // Same as BuildDownloadUpdatesForPollImpl() except the update origin/source is | 90 // Same as BuildDownloadUpdatesForPollImpl() except the update origin/source is |
87 // RETRY. | 91 // RETRY. |
88 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForRetryImpl( | 92 SYNC_EXPORT_PRIVATE void BuildDownloadUpdatesForRetryImpl( |
89 ModelTypeSet proto_request_types, | 93 ModelTypeSet proto_request_types, |
90 UpdateHandlerMap* update_handler_map, | 94 GetUpdatesProcessor* get_updates_processor, |
91 sync_pb::GetUpdatesMessage* get_updates); | 95 sync_pb::GetUpdatesMessage* get_updates); |
92 | 96 |
93 // Sends the specified message to the server and stores the response in a member | 97 // Sends the specified message to the server and stores the response in a member |
94 // of the |session|'s StatusController. | 98 // of the |session|'s StatusController. |
95 SYNC_EXPORT_PRIVATE SyncerError | 99 SYNC_EXPORT_PRIVATE SyncerError |
96 ExecuteDownloadUpdates(ModelTypeSet request_types, | 100 ExecuteDownloadUpdates(ModelTypeSet request_types, |
97 sessions::SyncSession* session, | 101 sessions::SyncSession* session, |
| 102 GetUpdatesProcessor* get_updates_processor, |
98 sync_pb::ClientToServerMessage* msg); | 103 sync_pb::ClientToServerMessage* msg); |
99 | 104 |
100 // Helper function for processing responses from the server. | 105 // Helper function for processing responses from the server. |
101 // Defined here for testing. | 106 // Defined here for testing. |
102 SYNC_EXPORT_PRIVATE SyncerError ProcessResponse( | 107 SYNC_EXPORT_PRIVATE SyncerError ProcessResponse( |
103 const sync_pb::GetUpdatesResponse& gu_response, | 108 const sync_pb::GetUpdatesResponse& gu_response, |
104 ModelTypeSet proto_request_types, | 109 ModelTypeSet proto_request_types, |
105 UpdateHandlerMap* handler_map, | 110 GetUpdatesProcessor* get_updates_processor, |
106 sessions::StatusController* status); | 111 sessions::StatusController* status); |
107 | 112 |
108 // Helper function to copy client debug info from debug_info_getter to | 113 // Helper function to copy client debug info from debug_info_getter to |
109 // debug_info. Defined here for testing. | 114 // debug_info. Defined here for testing. |
110 SYNC_EXPORT_PRIVATE void CopyClientDebugInfo( | 115 SYNC_EXPORT_PRIVATE void CopyClientDebugInfo( |
111 sessions::DebugInfoGetter* debug_info_getter, | 116 sessions::DebugInfoGetter* debug_info_getter, |
112 sync_pb::DebugInfo* debug_info); | 117 sync_pb::DebugInfo* debug_info); |
113 | 118 |
114 } // namespace download | 119 } // namespace download |
115 | 120 |
116 } // namespace syncer | 121 } // namespace syncer |
117 | 122 |
118 #endif // SYNC_ENGINE_DOWNLOAD_H_ | 123 #endif // SYNC_ENGINE_DOWNLOAD_H_ |
OLD | NEW |