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 CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/sync/sync_startup_tracker.h" | 14 #include "chrome/browser/sync/sync_startup_tracker.h" |
15 #include "chrome/browser/ui/webui/options/options_ui.h" | 15 #include "chrome/browser/ui/webui/options/options_ui.h" |
16 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
17 | 17 |
18 class LoginUIService; | 18 class LoginUIService; |
19 class ProfileSyncService; | 19 class ProfileSyncService; |
20 class SigninManagerBase; | 20 class SigninManagerBase; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 class WebContents; | 23 class WebContents; |
24 } | 24 } |
25 | 25 |
26 namespace signin_metrics { | 26 namespace signin_metrics { |
27 enum class AccessPoint; | 27 enum class AccessPoint; |
28 } | 28 } |
29 | 29 |
| 30 namespace sync_driver { |
| 31 class SyncSetupInProgressHandle; |
| 32 } |
| 33 |
30 class SyncSetupHandler : public options::OptionsPageUIHandler, | 34 class SyncSetupHandler : public options::OptionsPageUIHandler, |
31 public SyncStartupTracker::Observer, | 35 public SyncStartupTracker::Observer, |
32 public LoginUIService::LoginUI { | 36 public LoginUIService::LoginUI { |
33 public: | 37 public: |
34 SyncSetupHandler(); | 38 SyncSetupHandler(); |
35 ~SyncSetupHandler() override; | 39 ~SyncSetupHandler() override; |
36 | 40 |
37 // OptionsPageUIHandler implementation. | 41 // OptionsPageUIHandler implementation. |
38 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 42 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
39 void RegisterMessages() override; | 43 void RegisterMessages() override; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // If a wizard already exists, focus it and return true. | 150 // If a wizard already exists, focus it and return true. |
147 bool FocusExistingWizardIfPresent(); | 151 bool FocusExistingWizardIfPresent(); |
148 | 152 |
149 // Display the configure sync UI. If |passphrase_failed| is true, the account | 153 // Display the configure sync UI. If |passphrase_failed| is true, the account |
150 // requires a passphrase and one hasn't been provided or it was invalid. | 154 // requires a passphrase and one hasn't been provided or it was invalid. |
151 void DisplayConfigureSync(bool passphrase_failed); | 155 void DisplayConfigureSync(bool passphrase_failed); |
152 | 156 |
153 // Helper object used to wait for the sync backend to startup. | 157 // Helper object used to wait for the sync backend to startup. |
154 std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; | 158 std::unique_ptr<SyncStartupTracker> sync_startup_tracker_; |
155 | 159 |
| 160 // Handle preventing Sync from running until configuration is complete. |
| 161 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> setup_handle_; |
| 162 |
156 // Set to true whenever the sync configure UI is visible. This is used to tell | 163 // Set to true whenever the sync configure UI is visible. This is used to tell |
157 // what stage of the setup wizard the user was in and to update the UMA | 164 // what stage of the setup wizard the user was in and to update the UMA |
158 // histograms in the case that the user cancels out. | 165 // histograms in the case that the user cancels out. |
159 bool configuring_sync_; | 166 bool configuring_sync_; |
160 | 167 |
161 // The OneShotTimer object used to timeout of starting the sync backend | 168 // The OneShotTimer object used to timeout of starting the sync backend |
162 // service. | 169 // service. |
163 std::unique_ptr<base::OneShotTimer> backend_start_timer_; | 170 std::unique_ptr<base::OneShotTimer> backend_start_timer_; |
164 | 171 |
165 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); | 172 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); |
166 }; | 173 }; |
167 | 174 |
168 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 175 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ |
OLD | NEW |