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_SYNC_SETUP_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/timer.h" |
10 #include "chrome/browser/signin/signin_tracker.h" | 11 #include "chrome/browser/signin/signin_tracker.h" |
11 #include "chrome/browser/ui/webui/options2/options_ui.h" | 12 #include "chrome/browser/ui/webui/options2/options_ui.h" |
12 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 13 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
13 | 14 |
14 class LoginUIService; | 15 class LoginUIService; |
15 class ProfileManager; | 16 class ProfileManager; |
16 class ProfileSyncService; | 17 class ProfileSyncService; |
17 class SigninManager; | 18 class SigninManager; |
18 | 19 |
19 class SyncSetupHandler : public options2::OptionsPageUIHandler, | 20 class SyncSetupHandler : public options2::OptionsPageUIHandler, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void HandleSubmitAuth(const base::ListValue* args); | 103 void HandleSubmitAuth(const base::ListValue* args); |
103 void HandleConfigure(const base::ListValue* args); | 104 void HandleConfigure(const base::ListValue* args); |
104 void HandlePassphraseEntry(const base::ListValue* args); | 105 void HandlePassphraseEntry(const base::ListValue* args); |
105 void HandlePassphraseCancel(const base::ListValue* args); | 106 void HandlePassphraseCancel(const base::ListValue* args); |
106 void HandleAttachHandler(const base::ListValue* args); | 107 void HandleAttachHandler(const base::ListValue* args); |
107 void HandleShowErrorUI(const base::ListValue* args); | 108 void HandleShowErrorUI(const base::ListValue* args); |
108 void HandleShowSetupUI(const base::ListValue* args); | 109 void HandleShowSetupUI(const base::ListValue* args); |
109 void HandleShowSetupUIWithoutLogin(const base::ListValue* args); | 110 void HandleShowSetupUIWithoutLogin(const base::ListValue* args); |
110 void HandleDoSignOutOnAuthError(const base::ListValue* args); | 111 void HandleDoSignOutOnAuthError(const base::ListValue* args); |
111 void HandleStopSyncing(const base::ListValue* args); | 112 void HandleStopSyncing(const base::ListValue* args); |
| 113 void HandleCloseTimeout(const base::ListValue* args); |
112 | 114 |
113 // Helper routine that gets the Profile associated with this object (virtual | 115 // Helper routine that gets the Profile associated with this object (virtual |
114 // so tests can override). | 116 // so tests can override). |
115 virtual Profile* GetProfile() const; | 117 virtual Profile* GetProfile() const; |
116 | 118 |
117 // Shows the GAIA login success page then exits. | 119 // Shows the GAIA login success page then exits. |
118 void DisplayGaiaSuccessAndClose(); | 120 void DisplayGaiaSuccessAndClose(); |
119 | 121 |
120 // Displays the GAIA login success page then transitions to sync setup. | 122 // Displays the GAIA login success page then transitions to sync setup. |
121 void DisplayGaiaSuccessAndSettingUp(); | 123 void DisplayGaiaSuccessAndSettingUp(); |
(...skipping 12 matching lines...) Expand all Loading... |
134 // A utility function to call before actually showing setup dialog. Makes sure | 136 // A utility function to call before actually showing setup dialog. Makes sure |
135 // that a new dialog can be shown and sets flag that setup is in progress. | 137 // that a new dialog can be shown and sets flag that setup is in progress. |
136 bool PrepareSyncSetup(); | 138 bool PrepareSyncSetup(); |
137 | 139 |
138 // Displays spinner-only UI indicating that something is going on in the | 140 // Displays spinner-only UI indicating that something is going on in the |
139 // background. | 141 // background. |
140 // TODO(kochi): better to show some message that the user can understand what | 142 // TODO(kochi): better to show some message that the user can understand what |
141 // is running in the background. | 143 // is running in the background. |
142 void DisplaySpinner(); | 144 void DisplaySpinner(); |
143 | 145 |
144 // Returns true if this is the active login object. | 146 // Displays an error dialog which shows timeout of starting the sync backend. |
| 147 void DisplayTimeout(); |
| 148 |
| 149 // Returns true if this object is the active login object. |
145 bool IsActiveLogin() const; | 150 bool IsActiveLogin() const; |
146 | 151 |
147 // Initiates a login via the signin manager. | 152 // Initiates a login via the signin manager. |
148 void TryLogin(const std::string& username, | 153 void TryLogin(const std::string& username, |
149 const std::string& password, | 154 const std::string& password, |
150 const std::string& captcha, | 155 const std::string& captcha, |
151 const std::string& access_code); | 156 const std::string& access_code); |
152 | 157 |
153 // If a wizard already exists, focus it and return true. | 158 // If a wizard already exists, focus it and return true. |
154 bool FocusExistingWizardIfPresent(); | 159 bool FocusExistingWizardIfPresent(); |
(...skipping 30 matching lines...) Expand all Loading... |
185 // Cache of the last name the client attempted to authenticate. | 190 // Cache of the last name the client attempted to authenticate. |
186 std::string last_attempted_user_email_; | 191 std::string last_attempted_user_email_; |
187 | 192 |
188 // The error from the last signin attempt. | 193 // The error from the last signin attempt. |
189 GoogleServiceAuthError last_signin_error_; | 194 GoogleServiceAuthError last_signin_error_; |
190 | 195 |
191 // When setup starts with login UI, retry login if signing in failed. | 196 // When setup starts with login UI, retry login if signing in failed. |
192 // When setup starts without login UI, do not retry login and fail. | 197 // When setup starts without login UI, do not retry login and fail. |
193 bool retry_on_signin_failure_; | 198 bool retry_on_signin_failure_; |
194 | 199 |
| 200 // The OneShotTimer object used to timeout of starting the sync backend |
| 201 // service. |
| 202 scoped_ptr<base::OneShotTimer<SyncSetupHandler> > backend_start_timer_; |
| 203 |
195 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); | 204 DISALLOW_COPY_AND_ASSIGN(SyncSetupHandler); |
196 }; | 205 }; |
197 | 206 |
198 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ | 207 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_SETUP_HANDLER_H_ |
OLD | NEW |