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

Side by Side Diff: sync/engine/syncer_types.h

Issue 10197004: [Sync] Convert SyncSessionSnapshot to a copy-able class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 years, 8 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
« no previous file with comments | « sync/engine/syncer_command.cc ('k') | sync/engine/syncer_types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_ENGINE_SYNCER_TYPES_H_ 5 #ifndef SYNC_ENGINE_SYNCER_TYPES_H_
6 #define SYNC_ENGINE_SYNCER_TYPES_H_ 6 #define SYNC_ENGINE_SYNCER_TYPES_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map>
10 #include <string>
11 #include <vector>
12
13 #include "base/observer_list.h"
14 #include "sync/syncable/model_type.h"
15
16 namespace syncable {
17 class Id;
18 }
19
20 // The intent of this is to keep all shared data types and enums for the syncer 9 // The intent of this is to keep all shared data types and enums for the syncer
21 // in a single place without having dependencies between other files. 10 // in a single place without having dependencies between other files.
22 namespace browser_sync { 11 namespace browser_sync {
23 12
24 namespace sessions {
25 struct SyncSessionSnapshot;
26 }
27 class Syncer;
28
29 enum UpdateAttemptResponse { 13 enum UpdateAttemptResponse {
30 // Update was applied or safely ignored. 14 // Update was applied or safely ignored.
31 SUCCESS, 15 SUCCESS,
32 16
33 // The conditions described by the following enum values are not mutually 17 // The conditions described by the following enum values are not mutually
34 // exclusive. The list has been ordered according to priority in the case of 18 // exclusive. The list has been ordered according to priority in the case of
35 // overlap, with highest priority first. 19 // overlap, with highest priority first.
36 // 20 //
37 // For example, in the case where an item had both the IS_UNSYCNED and 21 // For example, in the case where an item had both the IS_UNSYCNED and
38 // IS_UNAPPLIED_UPDATE flags set (CONFLICT_SIMPLE), and a SERVER_PARENT_ID 22 // IS_UNAPPLIED_UPDATE flags set (CONFLICT_SIMPLE), and a SERVER_PARENT_ID
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 VERIFY_UNDELETE, 75 VERIFY_UNDELETE,
92 VERIFY_SKIP, 76 VERIFY_SKIP,
93 VERIFY_UNDECIDED 77 VERIFY_UNDECIDED
94 }; 78 };
95 79
96 enum VerifyCommitResult { 80 enum VerifyCommitResult {
97 VERIFY_UNSYNCABLE, 81 VERIFY_UNSYNCABLE,
98 VERIFY_OK, 82 VERIFY_OK,
99 }; 83 };
100 84
101 struct SyncEngineEvent {
102 enum EventCause {
103 ////////////////////////////////////////////////////////////////
104 // Sent on entry of Syncer state machine
105 SYNC_CYCLE_BEGIN,
106
107 // SyncerCommand generated events.
108 STATUS_CHANGED,
109
110 // We have reached the SYNCER_END state in the main sync loop.
111 SYNC_CYCLE_ENDED,
112
113 ////////////////////////////////////////////////////////////////
114 // Generated in response to specific protocol actions or events.
115
116 // New token in updated_token.
117 UPDATED_TOKEN,
118
119 // This is sent after the Syncer (and SyncerThread) have initiated self
120 // halt due to no longer being permitted to communicate with the server.
121 // The listener should sever the sync / browser connections and delete sync
122 // data (i.e. as if the user clicked 'Stop Syncing' in the browser.
123 STOP_SYNCING_PERMANENTLY,
124
125 // These events are sent to indicate when we know the clearing of
126 // server data have failed or succeeded.
127 CLEAR_SERVER_DATA_SUCCEEDED,
128 CLEAR_SERVER_DATA_FAILED,
129
130 // This event is sent when we receive an actionable error. It is upto
131 // the listeners to figure out the action to take using the snapshot sent.
132 ACTIONABLE_ERROR,
133 };
134
135 explicit SyncEngineEvent(EventCause cause);
136 ~SyncEngineEvent();
137
138 EventCause what_happened;
139
140 // The last session used for syncing.
141 const sessions::SyncSessionSnapshot* snapshot;
142
143 // Update-Client-Auth returns a new token for sync use.
144 std::string updated_token;
145 };
146
147 class SyncEngineEventListener {
148 public:
149 // TODO(tim): Consider splitting this up to multiple callbacks, rather than
150 // have to do Event e(type); OnSyncEngineEvent(e); at all callsites,
151 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) = 0;
152 protected:
153 virtual ~SyncEngineEventListener() {}
154 };
155
156 } // namespace browser_sync 85 } // namespace browser_sync
157 86
158 #endif // SYNC_ENGINE_SYNCER_TYPES_H_ 87 #endif // SYNC_ENGINE_SYNCER_TYPES_H_
OLDNEW
« no previous file with comments | « sync/engine/syncer_command.cc ('k') | sync/engine/syncer_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698