OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_SYNC_SYNC_STARTUP_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_STARTUP_TRACKER_H_ |
6 #define CHROME_BROWSER_SYNC_SYNC_STARTUP_TRACKER_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_STARTUP_TRACKER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/sync/profile_sync_service_observer.h" | 10 #include "chrome/browser/sync/profile_sync_service_observer.h" |
11 | 11 |
12 class Profile; | 12 class Profile; |
13 | 13 |
14 // SyncStartupTracker provides a centralized way for observers to detect when | 14 // SyncStartupTracker provides a centralized way for observers to detect when |
15 // ProfileSyncService has successfully started up, or when startup has failed | 15 // ProfileSyncService has successfully started up, or when startup has failed |
16 // due to some kind of error. This code was originally part of SigninTracker | 16 // due to some kind of error. This code was originally part of SigninTracker |
17 // but now that sync initialization is no longer a required part of signin, | 17 // but now that sync initialization is no longer a required part of signin, |
18 // it has been broken out of that class so only those places that care about | 18 // it has been broken out of that class so only those places that care about |
19 // sync initialization depend on it. | 19 // sync initialization depend on it. |
20 class SyncStartupTracker : public ProfileSyncServiceObserver { | 20 class SyncStartupTracker : public ProfileSyncServiceObserver { |
21 public: | 21 public: |
22 // Observer interface used to notify observers when sync has started up. | 22 // Observer interface used to notify observers when sync has started up. |
23 class Observer { | 23 class Observer { |
24 public: | 24 public: |
| 25 virtual ~Observer() {} |
| 26 |
25 virtual void SyncStartupCompleted() = 0; | 27 virtual void SyncStartupCompleted() = 0; |
26 virtual void SyncStartupFailed() = 0; | 28 virtual void SyncStartupFailed() = 0; |
27 }; | 29 }; |
28 | 30 |
29 SyncStartupTracker(Profile* profile, Observer* observer); | 31 SyncStartupTracker(Profile* profile, Observer* observer); |
30 virtual ~SyncStartupTracker(); | 32 virtual ~SyncStartupTracker(); |
31 | 33 |
32 enum SyncServiceState { | 34 enum SyncServiceState { |
33 // Sync backend is still starting up. | 35 // Sync backend is still starting up. |
34 SYNC_STARTUP_PENDING, | 36 SYNC_STARTUP_PENDING, |
(...skipping 20 matching lines...) Expand all Loading... |
55 // Profile whose ProfileSyncService we should track. | 57 // Profile whose ProfileSyncService we should track. |
56 Profile* profile_; | 58 Profile* profile_; |
57 | 59 |
58 // Weak pointer to the observer to notify. | 60 // Weak pointer to the observer to notify. |
59 Observer* observer_; | 61 Observer* observer_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(SyncStartupTracker); | 63 DISALLOW_COPY_AND_ASSIGN(SyncStartupTracker); |
62 }; | 64 }; |
63 | 65 |
64 #endif // CHROME_BROWSER_SYNC_SYNC_STARTUP_TRACKER_H_ | 66 #endif // CHROME_BROWSER_SYNC_SYNC_STARTUP_TRACKER_H_ |
OLD | NEW |