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 // Sends the specified message to the server and stores the response in a member | 81 // Sends the specified message to the server and stores the response in a member |
79 // of the |session|'s StatusController. | 82 // of the |session|'s StatusController. |
80 SYNC_EXPORT_PRIVATE SyncerError | 83 SYNC_EXPORT_PRIVATE SyncerError |
81 ExecuteDownloadUpdates(ModelTypeSet request_types, | 84 ExecuteDownloadUpdates(ModelTypeSet request_types, |
82 sessions::SyncSession* session, | 85 sessions::SyncSession* session, |
| 86 GetUpdatesProcessor* get_updates_processor, |
83 sync_pb::ClientToServerMessage* msg); | 87 sync_pb::ClientToServerMessage* msg); |
84 | 88 |
85 // Helper function for processing responses from the server. | 89 // Helper function for processing responses from the server. |
86 // Defined here for testing. | 90 // Defined here for testing. |
87 SYNC_EXPORT_PRIVATE SyncerError ProcessResponse( | 91 SYNC_EXPORT_PRIVATE SyncerError ProcessResponse( |
88 const sync_pb::GetUpdatesResponse& gu_response, | 92 const sync_pb::GetUpdatesResponse& gu_response, |
89 ModelTypeSet proto_request_types, | 93 ModelTypeSet proto_request_types, |
90 UpdateHandlerMap* handler_map, | 94 GetUpdatesProcessor* get_updates_processor, |
91 sessions::StatusController* status); | 95 sessions::StatusController* status); |
92 | 96 |
93 // Helper function to copy client debug info from debug_info_getter to | 97 // Helper function to copy client debug info from debug_info_getter to |
94 // debug_info. Defined here for testing. | 98 // debug_info. Defined here for testing. |
95 SYNC_EXPORT_PRIVATE void CopyClientDebugInfo( | 99 SYNC_EXPORT_PRIVATE void CopyClientDebugInfo( |
96 sessions::DebugInfoGetter* debug_info_getter, | 100 sessions::DebugInfoGetter* debug_info_getter, |
97 sync_pb::DebugInfo* debug_info); | 101 sync_pb::DebugInfo* debug_info); |
98 | 102 |
99 } // namespace download | 103 } // namespace download |
100 | 104 |
101 } // namespace syncer | 105 } // namespace syncer |
102 | 106 |
103 #endif // SYNC_ENGINE_DOWNLOAD_H_ | 107 #endif // SYNC_ENGINE_DOWNLOAD_H_ |
OLD | NEW |