| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/system/chromeos/devicetype_utils.h" | 13 #include "ash/system/chromeos/devicetype_utils.h" |
| 14 #include "ash/wm/lock_state_controller.h" | 14 #include "ash/wm/lock_state_controller.h" |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 20 #include "base/single_thread_task_runner.h" |
| 20 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
| 21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 23 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/sys_info.h" | 26 #include "base/sys_info.h" |
| 27 #include "base/threading/thread_task_runner_handle.h" |
| 26 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
| 27 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 30 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 29 #include "chrome/browser/browser_shutdown.h" | 31 #include "chrome/browser/browser_shutdown.h" |
| 30 #include "chrome/browser/chrome_notification_types.h" | 32 #include "chrome/browser/chrome_notification_types.h" |
| 31 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 33 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 32 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 34 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 33 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" | 35 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" |
| 34 #include "chrome/browser/chromeos/login/hwid_checker.h" | 36 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 35 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 37 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 652 |
| 651 update_state_closure_.Cancel(); | 653 update_state_closure_.Cancel(); |
| 652 | 654 |
| 653 if ((state == NetworkStateInformer::OFFLINE && !force_update) || | 655 if ((state == NetworkStateInformer::OFFLINE && !force_update) || |
| 654 has_pending_auth_ui_) { | 656 has_pending_auth_ui_) { |
| 655 update_state_closure_.Reset( | 657 update_state_closure_.Reset( |
| 656 base::Bind(&SigninScreenHandler::UpdateStateInternal, | 658 base::Bind(&SigninScreenHandler::UpdateStateInternal, |
| 657 weak_factory_.GetWeakPtr(), | 659 weak_factory_.GetWeakPtr(), |
| 658 reason, | 660 reason, |
| 659 true)); | 661 true)); |
| 660 base::MessageLoop::current()->PostDelayedTask( | 662 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 661 FROM_HERE, | 663 FROM_HERE, update_state_closure_.callback(), |
| 662 update_state_closure_.callback(), | |
| 663 base::TimeDelta::FromSeconds( | 664 base::TimeDelta::FromSeconds( |
| 664 zero_offline_timeout_for_test_ ? 0 : kOfflineTimeoutSec)); | 665 zero_offline_timeout_for_test_ ? 0 : kOfflineTimeoutSec)); |
| 665 return; | 666 return; |
| 666 } | 667 } |
| 667 | 668 |
| 668 // Don't show or hide error screen if we're in connecting state. | 669 // Don't show or hide error screen if we're in connecting state. |
| 669 if (state == NetworkStateInformer::CONNECTING && !force_update) { | 670 if (state == NetworkStateInformer::CONNECTING && !force_update) { |
| 670 if (connecting_closure_.IsCancelled()) { | 671 if (connecting_closure_.IsCancelled()) { |
| 671 // First notification about CONNECTING state. | 672 // First notification about CONNECTING state. |
| 672 connecting_closure_.Reset( | 673 connecting_closure_.Reset( |
| 673 base::Bind(&SigninScreenHandler::UpdateStateInternal, | 674 base::Bind(&SigninScreenHandler::UpdateStateInternal, |
| 674 weak_factory_.GetWeakPtr(), | 675 weak_factory_.GetWeakPtr(), |
| 675 reason, | 676 reason, |
| 676 true)); | 677 true)); |
| 677 base::MessageLoop::current()->PostDelayedTask( | 678 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 678 FROM_HERE, | 679 FROM_HERE, connecting_closure_.callback(), |
| 679 connecting_closure_.callback(), | |
| 680 base::TimeDelta::FromSeconds(kConnectingTimeoutSec)); | 680 base::TimeDelta::FromSeconds(kConnectingTimeoutSec)); |
| 681 } | 681 } |
| 682 return; | 682 return; |
| 683 } | 683 } |
| 684 connecting_closure_.Cancel(); | 684 connecting_closure_.Cancel(); |
| 685 | 685 |
| 686 const bool is_online = IsOnline(state, reason); | 686 const bool is_online = IsOnline(state, reason); |
| 687 const bool is_behind_captive_portal = IsBehindCaptivePortal(state, reason); | 687 const bool is_behind_captive_portal = IsBehindCaptivePortal(state, reason); |
| 688 const bool is_gaia_loading_timeout = | 688 const bool is_gaia_loading_timeout = |
| 689 (reason == NetworkError::ERROR_REASON_LOADING_TIMEOUT); | 689 (reason == NetworkError::ERROR_REASON_LOADING_TIMEOUT); |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 void SigninScreenHandler::OnFeedbackFinished() { | 1437 void SigninScreenHandler::OnFeedbackFinished() { |
| 1438 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); | 1438 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); |
| 1439 | 1439 |
| 1440 // Recreate user's cryptohome after the feedkback is attempted. | 1440 // Recreate user's cryptohome after the feedkback is attempted. |
| 1441 HandleResyncUserData(); | 1441 HandleResyncUserData(); |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 } // namespace chromeos | 1444 } // namespace chromeos |
| OLD | NEW |