Chromium Code Reviews| Index: chrome/browser/ui/webui/sync_setup_handler.cc |
| diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc |
| index dfc6dfe0c6e8d2861626ddb94dea95b1c7959791..35d6179f8da7a9926c9d0e1e62454bd80f27960d 100644 |
| --- a/chrome/browser/ui/webui/sync_setup_handler.cc |
| +++ b/chrome/browser/ui/webui/sync_setup_handler.cc |
| @@ -284,6 +284,8 @@ void SyncSetupHandler::GetStaticLocalizedValues( |
| static OptionsStringResource resources[] = { |
| { "syncSetupConfigureTitle", IDS_SYNC_SETUP_CONFIGURE_TITLE }, |
| + { "syncSetupTimeOutTitle", IDS_SYNC_SETUP_TIME_OUT_TITLE }, |
| + { "syncSetupTimeOutContent", IDS_SYNC_SETUP_TIME_OUT_CONTENT }, |
| { "cannotBeBlank", IDS_SYNC_CANNOT_BE_BLANK }, |
| { "emailLabel", IDS_SYNC_LOGIN_EMAIL_NEW_LINE }, |
| { "passwordLabel", IDS_SYNC_LOGIN_PASSWORD_NEW_LINE }, |
| @@ -536,6 +538,20 @@ void SyncSetupHandler::DisplaySpinner() { |
| configuring_sync_ = true; |
| StringValue page("spinner"); |
| DictionaryValue args; |
| + |
| + const int kTimeoutSec = 30; |
| + login_timer_.reset(new base::OneShotTimer<SyncSetupHandler>()); |
| + login_timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutSec), |
| + this, &SyncSetupHandler::DisplayTimeOut); |
| + web_ui()->CallJavascriptFunction( |
| + "SyncSetupOverlay.showSyncSetupPage", page, args); |
| +} |
| + |
| +void SyncSetupHandler::DisplayTimeOut() { |
| + configuring_sync_ = false; |
|
kochi
2012/06/13 09:08:29
Timeout is handled, but still need to handle other
peria
2012/06/14 01:55:12
Done.
|
| + StringValue page("timeout"); |
| + DictionaryValue args; |
| + |
| web_ui()->CallJavascriptFunction( |
| "SyncSetupOverlay.showSyncSetupPage", page, args); |
| } |
| @@ -662,6 +678,10 @@ void SyncSetupHandler::GaiaCredentialsValid() { |
| } |
| void SyncSetupHandler::SigninFailed(const GoogleServiceAuthError& error) { |
| + // Stop a timer to handle timeout in waiting for checking network connection. |
| + if (login_timer_.get()) |
| + login_timer_.reset(); |
| + |
| last_signin_error_ = error; |
| // Got a failed signin - this is either just a typical auth error, or a |
| // sync error (treat sync errors as "fatal errors" - i.e. non-auth errors). |
| @@ -684,6 +704,10 @@ ProfileSyncService* SyncSetupHandler::GetSyncService() const { |
| void SyncSetupHandler::SigninSuccess() { |
| DCHECK(GetSyncService()->sync_initialized()); |
| + // Stop a timer to handle timeout in waiting for checking network connection. |
| + if (login_timer_.get()) |
| + login_timer_.reset(); |
| + |
| // If we have signed in while sync is already setup, it must be due to some |
| // kind of re-authentication flow. In that case, just close the signin dialog |
| // rather than forcing the user to go through sync configuration. |