OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_SYNC_ENGINE_EVENT_H_ | 5 #ifndef SYNC_ENGINE_SYNC_ENGINE_EVENT_H_ |
6 #define SYNC_ENGINE_SYNC_ENGINE_EVENT_H_ | 6 #define SYNC_ENGINE_SYNC_ENGINE_EVENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "sync/base/sync_export.h" |
11 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 12 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
12 | 13 |
13 namespace syncable { | 14 namespace syncable { |
14 class Id; | 15 class Id; |
15 } | 16 } |
16 | 17 |
17 namespace syncer { | 18 namespace syncer { |
18 | 19 |
19 struct SyncEngineEvent { | 20 struct SYNC_EXPORT_PRIVATE SyncEngineEvent { |
20 enum EventCause { | 21 enum EventCause { |
21 //////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////// |
22 // Sent on entry of Syncer state machine | 23 // Sent on entry of Syncer state machine |
23 SYNC_CYCLE_BEGIN, | 24 SYNC_CYCLE_BEGIN, |
24 | 25 |
25 // SyncerCommand generated events. | 26 // SyncerCommand generated events. |
26 STATUS_CHANGED, | 27 STATUS_CHANGED, |
27 | 28 |
28 // We have reached the SYNCER_END state in the main sync loop. | 29 // We have reached the SYNCER_END state in the main sync loop. |
29 SYNC_CYCLE_ENDED, | 30 SYNC_CYCLE_ENDED, |
(...skipping 20 matching lines...) Expand all Loading... |
50 | 51 |
51 EventCause what_happened; | 52 EventCause what_happened; |
52 | 53 |
53 // The last session used for syncing. | 54 // The last session used for syncing. |
54 sessions::SyncSessionSnapshot snapshot; | 55 sessions::SyncSessionSnapshot snapshot; |
55 | 56 |
56 // Update-Client-Auth returns a new token for sync use. | 57 // Update-Client-Auth returns a new token for sync use. |
57 std::string updated_token; | 58 std::string updated_token; |
58 }; | 59 }; |
59 | 60 |
60 class SyncEngineEventListener { | 61 class SYNC_EXPORT_PRIVATE SyncEngineEventListener { |
61 public: | 62 public: |
62 // TODO(tim): Consider splitting this up to multiple callbacks, rather than | 63 // TODO(tim): Consider splitting this up to multiple callbacks, rather than |
63 // have to do Event e(type); OnSyncEngineEvent(e); at all callsites, | 64 // have to do Event e(type); OnSyncEngineEvent(e); at all callsites, |
64 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) = 0; | 65 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) = 0; |
65 protected: | 66 protected: |
66 virtual ~SyncEngineEventListener() {} | 67 virtual ~SyncEngineEventListener() {} |
67 }; | 68 }; |
68 | 69 |
69 } // namespace syncer | 70 } // namespace syncer |
70 | 71 |
71 #endif // SYNC_ENGINE_SYNC_ENGINE_EVENT_H_ | 72 #endif // SYNC_ENGINE_SYNC_ENGINE_EVENT_H_ |
OLD | NEW |