Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/sync/engine/process_commit_response_command.h

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_PROCESS_COMMIT_RESPONSE_COMMAND_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
7 #pragma once
8
9 #include <set>
10 #include <string>
11
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "chrome/browser/sync/engine/model_changing_syncer_command.h"
15 #include "chrome/browser/sync/engine/syncproto.h"
16
17 namespace syncable {
18 class Id;
19 class WriteTransaction;
20 class MutableEntry;
21 }
22
23 namespace browser_sync {
24
25 class ProcessCommitResponseCommand : public ModelChangingSyncerCommand {
26 public:
27
28 ProcessCommitResponseCommand();
29 virtual ~ProcessCommitResponseCommand();
30
31 protected:
32 // ModelChangingSyncerCommand implementation.
33 virtual std::set<ModelSafeGroup> GetGroupsToChange(
34 const sessions::SyncSession& session) const OVERRIDE;
35 virtual SyncerError ModelNeutralExecuteImpl(
36 sessions::SyncSession* session) OVERRIDE;
37 virtual SyncerError ModelChangingExecuteImpl(
38 sessions::SyncSession* session) OVERRIDE;
39
40 private:
41 CommitResponse::ResponseType ProcessSingleCommitResponse(
42 syncable::WriteTransaction* trans,
43 const sync_pb::CommitResponse_EntryResponse& pb_commit_response,
44 const sync_pb::SyncEntity& pb_committed_entry,
45 const syncable::Id& pre_commit_id,
46 std::set<syncable::Id>* conflicting_new_directory_ids,
47 std::set<syncable::Id>* deleted_folders);
48
49 // Actually does the work of execute.
50 SyncerError ProcessCommitResponse(sessions::SyncSession* session);
51
52 void ProcessSuccessfulCommitResponse(
53 const sync_pb::SyncEntity& committed_entry,
54 const CommitResponse_EntryResponse& entry_response,
55 const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry,
56 bool syncing_was_set, std::set<syncable::Id>* deleted_folders);
57
58 // Update the BASE_VERSION and SERVER_VERSION, post-commit.
59 // Helper for ProcessSuccessfulCommitResponse.
60 bool UpdateVersionAfterCommit(
61 const sync_pb::SyncEntity& committed_entry,
62 const CommitResponse_EntryResponse& entry_response,
63 const syncable::Id& pre_commit_id,
64 syncable::MutableEntry* local_entry);
65
66 // If the server generated an ID for us during a commit, apply the new ID.
67 // Helper for ProcessSuccessfulCommitResponse.
68 bool ChangeIdAfterCommit(
69 const CommitResponse_EntryResponse& entry_response,
70 const syncable::Id& pre_commit_id,
71 syncable::MutableEntry* local_entry);
72
73 // Update the SERVER_ fields to reflect the server state after committing.
74 // Helper for ProcessSuccessfulCommitResponse.
75 void UpdateServerFieldsAfterCommit(
76 const sync_pb::SyncEntity& committed_entry,
77 const CommitResponse_EntryResponse& entry_response,
78 syncable::MutableEntry* local_entry);
79
80 // The server can override some values during a commit; the overridden values
81 // are returned as fields in the CommitResponse_EntryResponse. This method
82 // stores the fields back in the client-visible (i.e. not the SERVER_* fields)
83 // fields of the entry. This should only be done if the item did not change
84 // locally while the commit was in flight.
85 // Helper for ProcessSuccessfulCommitResponse.
86 void OverrideClientFieldsAfterCommit(
87 const sync_pb::SyncEntity& committed_entry,
88 const CommitResponse_EntryResponse& entry_response,
89 syncable::MutableEntry* local_entry);
90
91 // Helper to extract the final name from the protobufs.
92 const std::string& GetResultingPostCommitName(
93 const sync_pb::SyncEntity& committed_entry,
94 const CommitResponse_EntryResponse& entry_response);
95
96 DISALLOW_COPY_AND_ASSIGN(ProcessCommitResponseCommand);
97 };
98
99 } // namespace browser_sync
100
101 #endif // CHROME_BROWSER_SYNC_ENGINE_PROCESS_COMMIT_RESPONSE_COMMAND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698