Chromium Code Reviews| 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 COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_OBSERVER_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_OBSERVER_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_OBSERVER_H_ | 6 #define COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_OBSERVER_H_ |
| 7 | 7 |
| 8 namespace syncer { | 8 namespace syncer { |
| 9 | 9 |
| 10 class SyncService; | |
| 11 | |
| 10 // Various UI components such as the New Tab page can be driven by observing | 12 // Various UI components such as the New Tab page can be driven by observing |
| 11 // the SyncService through this interface. | 13 // the SyncService through this interface. |
| 12 class SyncServiceObserver { | 14 class SyncServiceObserver { |
| 13 public: | 15 public: |
| 14 // When one of the following events occurs, OnStateChanged() is called. | 16 // When one of the following events occurs, OnStateChanged() is called. |
| 15 // Observers should query the service to determine what happened. | 17 // Observers should query the service to determine what happened. |
| 16 // - We initialized successfully. | 18 // - We initialized successfully. |
| 17 // - The sync servers are unavailable at this time. | 19 // - The sync servers are unavailable at this time. |
| 18 // - Credentials are now in flight for authentication. | 20 // - Credentials are now in flight for authentication. |
| 19 // - The data type configuration has started or ended. | 21 // - The data type configuration has started or ended. |
| 20 // - Sync shut down. | 22 // - Sync shut down. |
| 21 // - Sync errors (passphrase, auth, unrecoverable, actionable, etc.). | 23 // - Sync errors (passphrase, auth, unrecoverable, actionable, etc.). |
| 22 // - Encryption changes. | 24 // - Encryption changes. |
| 23 virtual void OnStateChanged() = 0; | 25 virtual void OnStateChanged() = 0; |
| 24 | 26 |
| 25 // If a client wishes to handle sync cycle completed events in a special way, | 27 // If a client wishes to handle sync cycle completed events in a special way, |
| 26 // they can use this function. By default, it re-routes to OnStateChanged(). | 28 // they can use this function. By default, it re-routes to OnStateChanged(). |
| 27 virtual void OnSyncCycleCompleted(); | 29 virtual void OnSyncCycleCompleted(); |
| 28 | 30 |
| 29 // Called when the sync service has finished the datatype configuration | 31 // Called when the sync service has finished the datatype configuration |
| 30 // process. | 32 // process. |
| 31 virtual void OnSyncConfigurationCompleted() {} | 33 virtual void OnSyncConfigurationCompleted(SyncService* sync) {} |
|
skym
2017/01/26 17:00:37
So I'm not sure what other checks/events you're li
Steven Holte
2017/01/26 20:31:47
Added SyncService* to all functions.
Also made a d
| |
| 32 | 34 |
| 33 // Called when a foreign session has been updated. | 35 // Called when a foreign session has been updated. |
| 34 virtual void OnForeignSessionUpdated() {} | 36 virtual void OnForeignSessionUpdated() {} |
| 35 | 37 |
| 38 // Called when the sync service is being shutdown permanently, so that | |
| 39 // longer-lived observers can drop references to it. | |
| 40 virtual void OnSyncShutdown(SyncService* sync) {} | |
| 41 | |
| 36 protected: | 42 protected: |
| 37 virtual ~SyncServiceObserver() {} | 43 virtual ~SyncServiceObserver() {} |
| 38 }; | 44 }; |
| 39 | 45 |
| 40 } // namespace syncer | 46 } // namespace syncer |
| 41 | 47 |
| 42 #endif // COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_OBSERVER_H_ | 48 #endif // COMPONENTS_SYNC_DRIVER_SYNC_SERVICE_OBSERVER_H_ |
| OLD | NEW |