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