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 #include "chrome/browser/ui/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 if (!service->sync_initialized()) { | 433 if (!service->sync_initialized()) { |
434 | 434 |
435 #if !defined(OS_CHROMEOS) | 435 #if !defined(OS_CHROMEOS) |
436 // When user tries to setup sync while the sync backend is not initialized, | 436 // When user tries to setup sync while the sync backend is not initialized, |
437 // kick the sync backend and wait for it to be ready and show spinner until | 437 // kick the sync backend and wait for it to be ready and show spinner until |
438 // the backend gets ready. | 438 // the backend gets ready. |
439 retry_on_signin_failure_ = false; | 439 retry_on_signin_failure_ = false; |
440 #endif | 440 #endif |
441 | 441 |
442 service->UnsuppressAndStart(); | 442 service->UnsuppressAndStart(); |
443 DisplaySpinner(); | 443 |
| 444 // See if it's even possible to bring up the sync backend - if not |
| 445 // (unrecoverable error?), don't bother displaying a spinner that will be |
| 446 // immediately closed because this leads to some ugly infinite UI loop (see |
| 447 // http://crbug.com/244769). |
| 448 if (SigninTracker::GetSigninState(GetProfile(), NULL) != |
| 449 SigninTracker::WAITING_FOR_GAIA_VALIDATION) { |
| 450 DisplaySpinner(); |
| 451 } |
444 | 452 |
445 // To listen to the token available notifications, start SigninTracker. | 453 // To listen to the token available notifications, start SigninTracker. |
446 signin_tracker_.reset( | 454 signin_tracker_.reset( |
447 new SigninTracker(GetProfile(), | 455 new SigninTracker(GetProfile(), |
448 this, | 456 this, |
449 SigninTracker::SERVICES_INITIALIZING)); | 457 SigninTracker::SERVICES_INITIALIZING)); |
450 return; | 458 return; |
451 } | 459 } |
452 | 460 |
453 // Should only be called if user is signed in, so no longer need our | 461 // Should only be called if user is signed in, so no longer need our |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 1386 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
1379 } | 1387 } |
1380 | 1388 |
1381 void SyncSetupHandler::CloseOverlay() { | 1389 void SyncSetupHandler::CloseOverlay() { |
1382 // Stop a timer to handle timeout in waiting for sync setup. | 1390 // Stop a timer to handle timeout in waiting for sync setup. |
1383 backend_start_timer_.reset(); | 1391 backend_start_timer_.reset(); |
1384 | 1392 |
1385 CloseSyncSetup(); | 1393 CloseSyncSetup(); |
1386 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay"); | 1394 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay"); |
1387 } | 1395 } |
OLD | NEW |