summaryrefslogtreecommitdiffstats
path: root/sync/engine/download.h
blob: 0eeca977f0b7108ec9584aae0c5aa39853a61921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SYNC_ENGINE_DOWNLOAD_H_
#define SYNC_ENGINE_DOWNLOAD_H_

#include "sync/base/sync_export.h"
#include "sync/engine/get_updates_processor.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/internal_api/public/util/syncer_error.h"
#include "sync/protocol/sync.pb.h"

namespace sync_pb {
class DebugInfo;
}  // namespace sync_pb

namespace syncer {

namespace sessions {
class DebugInfoGetter;
class StatusController;
class SyncSession;
}  // namespace sessions

namespace download {

// Generic initialization of a GetUpdates message.
SYNC_EXPORT_PRIVATE void InitDownloadUpdatesContext(
    sessions::SyncSession* session,
    bool create_mobile_bookmarks_folder,
    sync_pb::ClientToServerMessage* message);

// Sends the specified message to the server and stores the response in a member
// of the |session|'s StatusController.
SYNC_EXPORT_PRIVATE SyncerError
    ExecuteDownloadUpdates(ModelTypeSet request_types,
                           sessions::SyncSession* session,
                           GetUpdatesProcessor* get_updates_processor,
                           sync_pb::ClientToServerMessage* msg);

// Helper function for processing responses from the server.
// Defined here for testing.
SYNC_EXPORT_PRIVATE SyncerError ProcessResponse(
    const sync_pb::GetUpdatesResponse& gu_response,
    ModelTypeSet proto_request_types,
    GetUpdatesProcessor* get_updates_processor,
    sessions::StatusController* status);

// Helper function to copy client debug info from debug_info_getter to
// debug_info.  Defined here for testing.
SYNC_EXPORT_PRIVATE void CopyClientDebugInfo(
    sessions::DebugInfoGetter* debug_info_getter,
    sync_pb::DebugInfo* debug_info);

}  // namespace download

}  // namespace syncer

#endif  // SYNC_ENGINE_DOWNLOAD_H_