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_SYNC_SETUP_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
11 #include "chrome/browser/sync/sync_startup_tracker.h" | 12 #include "chrome/browser/sync/sync_startup_tracker.h" |
12 #include "chrome/browser/ui/webui/options/options_ui.h" | |
13 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 13 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 14 #include "content/public/browser/web_ui_message_handler.h" |
14 | 15 |
15 class LoginUIService; | 16 class LoginUIService; |
16 class ProfileSyncService; | 17 class ProfileSyncService; |
17 class SigninManagerBase; | 18 class SigninManagerBase; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 class WebContents; | 21 class WebContents; |
| 22 class WebUI; |
21 } | 23 } |
22 | 24 |
23 class SyncSetupHandler : public options::OptionsPageUIHandler, | 25 class SyncSetupHandler : public content::WebUIMessageHandler, |
24 public SyncStartupTracker::Observer, | 26 public SyncStartupTracker::Observer, |
25 public LoginUIService::LoginUI { | 27 public LoginUIService::LoginUI { |
26 public: | 28 public: |
27 SyncSetupHandler(); | 29 explicit SyncSetupHandler(content::WebUI* web_ui); |
28 ~SyncSetupHandler() override; | 30 ~SyncSetupHandler() override; |
29 | 31 |
30 // OptionsPageUIHandler implementation. | 32 // content::WebUIMessageHandler implementation. |
31 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | |
32 void RegisterMessages() override; | 33 void RegisterMessages() override; |
33 | 34 |
34 // SyncStartupTracker::Observer implementation; | 35 // SyncStartupTracker::Observer implementation; |
35 void SyncStartupCompleted() override; | 36 void SyncStartupCompleted() override; |
36 void SyncStartupFailed() override; | 37 void SyncStartupFailed() override; |
37 | 38 |
38 // LoginUIService::LoginUI implementation. | 39 // LoginUIService::LoginUI implementation. |
39 void FocusUI() override; | 40 void FocusUI() override; |
40 void CloseUI() override; | 41 void CloseUI() override; |
41 | 42 |
42 static void GetStaticLocalizedValues( | |
43 base::DictionaryValue* localized_strings, | |
44 content::WebUI* web_ui); | |
45 | |
46 // Initializes the sync setup flow and shows the setup UI. | 43 // Initializes the sync setup flow and shows the setup UI. |
47 void OpenSyncSetup(); | 44 void OpenSyncSetup(); |
48 | 45 |
49 // Shows advanced configuration dialog without going through sign in dialog. | 46 // Shows advanced configuration dialog without going through sign in dialog. |
50 // Kicks the sync backend if necessary with showing spinner dialog until it | 47 // Kicks the sync backend if necessary with showing spinner dialog until it |
51 // gets ready. | 48 // gets ready. |
52 void OpenConfigureSync(); | 49 void OpenConfigureSync(); |
53 | 50 |
54 // Terminates the sync setup flow. | 51 // Terminates the sync setup flow. |
55 void CloseSyncSetup(); | 52 void CloseSyncSetup(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // histograms in the case that the user cancels out. | 147 // histograms in the case that the user cancels out. |
151 bool configuring_sync_; | 148 bool configuring_sync_; |
152 | 149 |
153 // The OneShotTimer object used to timeout of starting the sync backend | 150 // The OneShotTimer object used to timeout of starting the sync backend |
154 // service. | 151 // service. |
155 scoped_ptr<base::OneShotTimer> backend_start_timer_; | 152 scoped_ptr<base::OneShotTimer> backend_start_timer_; |
156 | 153 |
157 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); | 154 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); |
158 }; | 155 }; |
159 | 156 |
160 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SYNC_SETUP_HANDLER_H_ | 157 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
OLD | NEW |