| OLD | NEW |
| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // New token in updated_token. | 35 // New token in updated_token. |
| 36 UPDATED_TOKEN, | 36 UPDATED_TOKEN, |
| 37 | 37 |
| 38 // This is sent after the Syncer (and SyncerThread) have initiated self | 38 // This is sent after the Syncer (and SyncerThread) have initiated self |
| 39 // halt due to no longer being permitted to communicate with the server. | 39 // halt due to no longer being permitted to communicate with the server. |
| 40 // The listener should sever the sync / browser connections and delete sync | 40 // The listener should sever the sync / browser connections and delete sync |
| 41 // data (i.e. as if the user clicked 'Stop Syncing' in the browser. | 41 // data (i.e. as if the user clicked 'Stop Syncing' in the browser. |
| 42 STOP_SYNCING_PERMANENTLY, | 42 STOP_SYNCING_PERMANENTLY, |
| 43 | 43 |
| 44 // These events are sent to indicate when we know the clearing of | |
| 45 // server data have failed or succeeded. | |
| 46 CLEAR_SERVER_DATA_SUCCEEDED, | |
| 47 CLEAR_SERVER_DATA_FAILED, | |
| 48 | |
| 49 // This event is sent when we receive an actionable error. It is upto | 44 // This event is sent when we receive an actionable error. It is upto |
| 50 // the listeners to figure out the action to take using the snapshot sent. | 45 // the listeners to figure out the action to take using the snapshot sent. |
| 51 ACTIONABLE_ERROR, | 46 ACTIONABLE_ERROR, |
| 52 }; | 47 }; |
| 53 | 48 |
| 54 explicit SyncEngineEvent(EventCause cause); | 49 explicit SyncEngineEvent(EventCause cause); |
| 55 ~SyncEngineEvent(); | 50 ~SyncEngineEvent(); |
| 56 | 51 |
| 57 EventCause what_happened; | 52 EventCause what_happened; |
| 58 | 53 |
| 59 // The last session used for syncing. | 54 // The last session used for syncing. |
| 60 sessions::SyncSessionSnapshot snapshot; | 55 sessions::SyncSessionSnapshot snapshot; |
| 61 | 56 |
| 62 // Update-Client-Auth returns a new token for sync use. | 57 // Update-Client-Auth returns a new token for sync use. |
| 63 std::string updated_token; | 58 std::string updated_token; |
| 64 }; | 59 }; |
| 65 | 60 |
| 66 class SyncEngineEventListener { | 61 class SyncEngineEventListener { |
| 67 public: | 62 public: |
| 68 // TODO(tim): Consider splitting this up to multiple callbacks, rather than | 63 // TODO(tim): Consider splitting this up to multiple callbacks, rather than |
| 69 // have to do Event e(type); OnSyncEngineEvent(e); at all callsites, | 64 // have to do Event e(type); OnSyncEngineEvent(e); at all callsites, |
| 70 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) = 0; | 65 virtual void OnSyncEngineEvent(const SyncEngineEvent& event) = 0; |
| 71 protected: | 66 protected: |
| 72 virtual ~SyncEngineEventListener() {} | 67 virtual ~SyncEngineEventListener() {} |
| 73 }; | 68 }; |
| 74 | 69 |
| 75 } // namespace browser_sync | 70 } // namespace browser_sync |
| 76 | 71 |
| 77 #endif // SYNC_ENGINE_SYNC_ENGINE_EVENT_H_ | 72 #endif // SYNC_ENGINE_SYNC_ENGINE_EVENT_H_ |
| OLD | NEW |