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