| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/login/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: | 253 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED: |
| 254 if (!network->online()) | 254 if (!network->online()) |
| 255 RecordDiscrepancyWithShill(network, state.status); | 255 RecordDiscrepancyWithShill(network, state.status); |
| 256 break; | 256 break; |
| 257 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT: | 257 case NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_COUNT: |
| 258 NOTREACHED(); | 258 NOTREACHED(); |
| 259 break; | 259 break; |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 void EnableLazyDetection() { |
| 264 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); |
| 265 if (detector) |
| 266 detector->EnableLazyDetection(); |
| 267 } |
| 268 |
| 269 void DisableLazyDetection() { |
| 270 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); |
| 271 if (detector) |
| 272 detector->DisableLazyDetection(); |
| 273 } |
| 274 |
| 263 } // namespace | 275 } // namespace |
| 264 | 276 |
| 265 // SigninScreenHandler implementation ------------------------------------------ | 277 // SigninScreenHandler implementation ------------------------------------------ |
| 266 | 278 |
| 267 SigninScreenHandler::SigninScreenHandler( | 279 SigninScreenHandler::SigninScreenHandler( |
| 268 const scoped_refptr<NetworkStateInformer>& network_state_informer, | 280 const scoped_refptr<NetworkStateInformer>& network_state_informer, |
| 269 ErrorScreenActor* error_screen_actor) | 281 ErrorScreenActor* error_screen_actor) |
| 270 : ui_state_(UI_STATE_UNKNOWN), | 282 : ui_state_(UI_STATE_UNKNOWN), |
| 271 delegate_(NULL), | 283 delegate_(NULL), |
| 272 native_window_delegate_(NULL), | 284 native_window_delegate_(NULL), |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 bool offline_login_allowed = IsOfflineLoginAllowed() && | 661 bool offline_login_allowed = IsOfflineLoginAllowed() && |
| 650 IsSigninScreenError(error_screen_actor_->state()) && | 662 IsSigninScreenError(error_screen_actor_->state()) && |
| 651 error_screen_actor_->state() != ErrorScreenActor::STATE_TIMEOUT_ERROR; | 663 error_screen_actor_->state() != ErrorScreenActor::STATE_TIMEOUT_ERROR; |
| 652 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); | 664 error_screen_actor_->AllowOfflineLogin(offline_login_allowed); |
| 653 | 665 |
| 654 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { | 666 if (GetCurrentScreen() != OobeUI::SCREEN_ERROR_MESSAGE) { |
| 655 DictionaryValue params; | 667 DictionaryValue params; |
| 656 params.SetInteger("lastNetworkType", static_cast<int>(connection_type)); | 668 params.SetInteger("lastNetworkType", static_cast<int>(connection_type)); |
| 657 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); | 669 error_screen_actor_->Show(OobeUI::SCREEN_GAIA_SIGNIN, ¶ms); |
| 658 } | 670 } |
| 671 |
| 672 EnableLazyDetection(); |
| 659 } else { | 673 } else { |
| 660 if (IsSigninScreenHiddenByError()) { | 674 if (IsSigninScreenHiddenByError()) { |
| 661 LOG(WARNING) << "Hide offline message. state=" << state << ", " | 675 LOG(WARNING) << "Hide offline message. state=" << state << ", " |
| 662 << "network_id=" << network_id << ", " | 676 << "network_id=" << network_id << ", " |
| 663 << "reason=" << reason; | 677 << "reason=" << reason; |
| 664 error_screen_actor_->Hide(); | 678 error_screen_actor_->Hide(); |
| 665 | 679 |
| 666 // Forces a reload for Gaia screen on hiding error message. | 680 // Forces a reload for Gaia screen on hiding error message. |
| 667 if (is_gaia_signin && !is_gaia_reloaded) { | 681 if (is_gaia_signin && !is_gaia_reloaded) { |
| 668 ReloadGaiaScreen(); | 682 ReloadGaiaScreen(); |
| 669 is_gaia_reloaded = true; | 683 is_gaia_reloaded = true; |
| 670 } | 684 } |
| 671 } | 685 } |
| 686 |
| 687 DisableLazyDetection(); |
| 672 } | 688 } |
| 673 } | 689 } |
| 674 | 690 |
| 675 void SigninScreenHandler::ReloadGaiaScreen() { | 691 void SigninScreenHandler::ReloadGaiaScreen() { |
| 676 LOG(WARNING) << "Reload auth extension frame."; | 692 LOG(WARNING) << "Reload auth extension frame."; |
| 677 web_ui()->CallJavascriptFunction("login.GaiaSigninScreen.doReload"); | 693 web_ui()->CallJavascriptFunction("login.GaiaSigninScreen.doReload"); |
| 678 } | 694 } |
| 679 | 695 |
| 680 void SigninScreenHandler::ScheduleGaiaFrameReload() { | 696 void SigninScreenHandler::ScheduleGaiaFrameReload() { |
| 681 LOG(WARNING) << "Shedule retry for auth extension frame."; | 697 LOG(WARNING) << "Shedule retry for auth extension frame."; |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 if (!cros_settings) | 1753 if (!cros_settings) |
| 1738 return false; | 1754 return false; |
| 1739 | 1755 |
| 1740 // Offline login is allowed only when user pods are hidden. | 1756 // Offline login is allowed only when user pods are hidden. |
| 1741 bool show_pods; | 1757 bool show_pods; |
| 1742 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, &show_pods); | 1758 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, &show_pods); |
| 1743 return !show_pods; | 1759 return !show_pods; |
| 1744 } | 1760 } |
| 1745 | 1761 |
| 1746 } // namespace chromeos | 1762 } // namespace chromeos |
| OLD | NEW |