OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_STARTUP_CONTROLLER_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_STARTUP_CONTROLLER_H_ |
6 #define COMPONENTS_SYNC_DRIVER_STARTUP_CONTROLLER_H_ | 6 #define COMPONENTS_SYNC_DRIVER_STARTUP_CONTROLLER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Sets the setup in progress flag and tries to start sync if it's true. | 53 // Sets the setup in progress flag and tries to start sync if it's true. |
54 void SetSetupInProgress(bool setup_in_progress); | 54 void SetSetupInProgress(bool setup_in_progress); |
55 | 55 |
56 bool IsSetupInProgress() const { return setup_in_progress_; } | 56 bool IsSetupInProgress() const { return setup_in_progress_; } |
57 base::Time start_backend_time() const { return start_backend_time_; } | 57 base::Time start_backend_time() const { return start_backend_time_; } |
58 std::string GetBackendInitializationStateString() const; | 58 std::string GetBackendInitializationStateString() const; |
59 | 59 |
60 void OverrideFallbackTimeoutForTest(const base::TimeDelta& timeout); | 60 void OverrideFallbackTimeoutForTest(const base::TimeDelta& timeout); |
61 | 61 |
62 private: | 62 private: |
63 enum StartUpDeferredOption { | 63 enum StartUpDeferredOption { STARTUP_BACKEND_DEFERRED, STARTUP_IMMEDIATE }; |
64 STARTUP_BACKEND_DEFERRED, | |
65 STARTUP_IMMEDIATE | |
66 }; | |
67 // Returns true if all conditions to start the backend are met. | 64 // Returns true if all conditions to start the backend are met. |
68 bool StartUp(StartUpDeferredOption deferred_option); | 65 bool StartUp(StartUpDeferredOption deferred_option); |
69 void OnFallbackStartupTimerExpired(); | 66 void OnFallbackStartupTimerExpired(); |
70 | 67 |
71 // Records time spent in deferred state with UMA histograms. | 68 // Records time spent in deferred state with UMA histograms. |
72 void RecordTimeDeferred(); | 69 void RecordTimeDeferred(); |
73 | 70 |
74 // If true, will bypass the FirstSetupComplete check when triggering sync | 71 // If true, will bypass the FirstSetupComplete check when triggering sync |
75 // startup. | 72 // startup. |
76 bool bypass_setup_complete_; | 73 bool bypass_setup_complete_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 105 |
109 // Used to compute preferred_types from SyncPrefs as-needed. | 106 // Used to compute preferred_types from SyncPrefs as-needed. |
110 syncer::ModelTypeSet registered_types_; | 107 syncer::ModelTypeSet registered_types_; |
111 | 108 |
112 base::WeakPtrFactory<StartupController> weak_factory_; | 109 base::WeakPtrFactory<StartupController> weak_factory_; |
113 }; | 110 }; |
114 | 111 |
115 } // namespace browser_sync | 112 } // namespace browser_sync |
116 | 113 |
117 #endif // COMPONENTS_SYNC_DRIVER_STARTUP_CONTROLLER_H_ | 114 #endif // COMPONENTS_SYNC_DRIVER_STARTUP_CONTROLLER_H_ |
OLD | NEW |