OLD | NEW |
| (Empty) |
1 // Copyright 2012 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. | |
4 | |
5 #ifndef SYNC_ENGINE_DOWNLOAD_UPDATES_COMMAND_H_ | |
6 #define SYNC_ENGINE_DOWNLOAD_UPDATES_COMMAND_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/gtest_prod_util.h" | |
11 #include "sync/engine/syncer_command.h" | |
12 #include "sync/internal_api/public/base/model_type.h" | |
13 #include "sync/internal_api/public/engine/model_safe_worker.h" | |
14 #include "sync/protocol/sync.pb.h" | |
15 | |
16 namespace sync_pb { | |
17 class EntitySpecifics; | |
18 } | |
19 | |
20 namespace syncer { | |
21 | |
22 // Determine the enabled datatypes, download a batch of updates for them | |
23 // from the server, place the result in the SyncSession for further processing. | |
24 // | |
25 // The main inputs to this operation are the download_progress state | |
26 // in the syncable::Directory, and the set of enabled types as indicated by | |
27 // the SyncSession. DownloadUpdatesCommand will fetch updates for | |
28 // all the enabled types, using download_progress to indicate the starting | |
29 // point to the server. DownloadUpdatesCommand stores the server response | |
30 // in the SyncSession. Only one server request is performed per Execute | |
31 // operation. A loop that causes multiple Execute operations within a sync | |
32 // session can be found in the Syncer logic. When looping, the | |
33 // DownloadUpdatesCommand consumes the information stored by the | |
34 // StoreTimestampsCommand. | |
35 // | |
36 // In practice, DownloadUpdatesCommand should loop until all updates are | |
37 // downloaded for all enabled datatypes (i.e., until the server indicates | |
38 // changes_remaining == 0 in the GetUpdates response), or until an error | |
39 // is encountered. | |
40 class SYNC_EXPORT_PRIVATE DownloadUpdatesCommand : public SyncerCommand { | |
41 public: | |
42 // |create_mobile_bookmarks_folder| controls whether or not to | |
43 // create the mobile bookmarks folder if it's not already created. | |
44 // Should be set to true only by mobile clients. | |
45 explicit DownloadUpdatesCommand(bool create_mobile_bookmarks_folder); | |
46 virtual ~DownloadUpdatesCommand(); | |
47 | |
48 // SyncerCommand implementation. | |
49 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; | |
50 | |
51 private: | |
52 FRIEND_TEST_ALL_PREFIXES(DownloadUpdatesCommandTest, VerifyAppendDebugInfo); | |
53 void AppendClientDebugInfoIfNeeded(sessions::SyncSession* session, | |
54 sync_pb::DebugInfo* debug_info); | |
55 | |
56 const bool create_mobile_bookmarks_folder_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(DownloadUpdatesCommand); | |
59 }; | |
60 | |
61 } // namespace syncer | |
62 | |
63 #endif // SYNC_ENGINE_DOWNLOAD_UPDATES_COMMAND_H_ | |
OLD | NEW |