| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/ui/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/browser_shutdown.h" | 20 #include "chrome/browser/browser_shutdown.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 22 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 23 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 23 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 24 #include "chrome/browser/chromeos/base/locale_util.h" | 24 #include "chrome/browser/chromeos/base/locale_util.h" |
| 25 #include "chrome/browser/chromeos/boot_times_loader.h" | 25 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 26 #include "chrome/browser/chromeos/charger_replace/charger_replacement_dialog.h" | |
| 27 #include "chrome/browser/chromeos/first_run/drive_first_run_controller.h" | 26 #include "chrome/browser/chromeos/first_run/drive_first_run_controller.h" |
| 28 #include "chrome/browser/chromeos/first_run/first_run.h" | 27 #include "chrome/browser/chromeos/first_run/first_run.h" |
| 29 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 28 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 30 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 29 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 31 #include "chrome/browser/chromeos/language_preferences.h" | 30 #include "chrome/browser/chromeos/language_preferences.h" |
| 32 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 31 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
| 33 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 32 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 34 #include "chrome/browser/chromeos/login/helper.h" | 33 #include "chrome/browser/chromeos/login/helper.h" |
| 35 #include "chrome/browser/chromeos/login/login_utils.h" | 34 #include "chrome/browser/chromeos/login/login_utils.h" |
| 36 #include "chrome/browser/chromeos/login/login_wizard.h" | 35 #include "chrome/browser/chromeos/login/login_wizard.h" |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 auto_enrollment_controller_->ShouldEnrollSilently()) { | 986 auto_enrollment_controller_->ShouldEnrollSilently()) { |
| 988 sign_in_controller_->DoAutoEnrollment(); | 987 sign_in_controller_->DoAutoEnrollment(); |
| 989 } | 988 } |
| 990 } | 989 } |
| 991 | 990 |
| 992 void LoginDisplayHostImpl::LoadURL(const GURL& url) { | 991 void LoginDisplayHostImpl::LoadURL(const GURL& url) { |
| 993 InitLoginWindowAndView(); | 992 InitLoginWindowAndView(); |
| 994 // Subscribe to crash events. | 993 // Subscribe to crash events. |
| 995 content::WebContentsObserver::Observe(login_view_->GetWebContents()); | 994 content::WebContentsObserver::Observe(login_view_->GetWebContents()); |
| 996 login_view_->LoadURL(url); | 995 login_view_->LoadURL(url); |
| 997 | |
| 998 // LoadURL could be called after the spring charger dialog shows, and | |
| 999 // take away the focus from it. Set the focus back to the charger dialog | |
| 1000 // if it is visible. | |
| 1001 // See crbug.com/328538. | |
| 1002 ChargerReplacementDialog::SetFocusOnChargerDialogIfVisible(); | |
| 1003 } | 996 } |
| 1004 | 997 |
| 1005 void LoginDisplayHostImpl::ShowWebUI() { | 998 void LoginDisplayHostImpl::ShowWebUI() { |
| 1006 if (!login_window_ || !login_view_) { | 999 if (!login_window_ || !login_view_) { |
| 1007 NOTREACHED(); | 1000 NOTREACHED(); |
| 1008 return; | 1001 return; |
| 1009 } | 1002 } |
| 1010 VLOG(1) << "Login WebUI >> Show already initialized UI"; | 1003 VLOG(1) << "Login WebUI >> Show already initialized UI"; |
| 1011 login_window_->Show(); | 1004 login_window_->Show(); |
| 1012 login_view_->GetWebContents()->Focus(); | 1005 login_view_->GetWebContents()->Focus(); |
| 1013 if (::switches::IsTextInputFocusManagerEnabled()) | 1006 if (::switches::IsTextInputFocusManagerEnabled()) |
| 1014 login_view_->RequestFocus(); | 1007 login_view_->RequestFocus(); |
| 1015 login_view_->SetStatusAreaVisible(status_area_saved_visibility_); | 1008 login_view_->SetStatusAreaVisible(status_area_saved_visibility_); |
| 1016 login_view_->OnPostponedShow(); | 1009 login_view_->OnPostponedShow(); |
| 1017 | 1010 |
| 1018 // Login window could be shown after the spring charger dialog shows, and | |
| 1019 // take away the focus from it. Set the focus back to the charger dialog | |
| 1020 // if it is visible. | |
| 1021 // See crbug.com/328538. | |
| 1022 ChargerReplacementDialog::SetFocusOnChargerDialogIfVisible(); | |
| 1023 | |
| 1024 // We should reset this flag to allow changing of status area visibility. | 1011 // We should reset this flag to allow changing of status area visibility. |
| 1025 initialize_webui_hidden_ = false; | 1012 initialize_webui_hidden_ = false; |
| 1026 } | 1013 } |
| 1027 | 1014 |
| 1028 void LoginDisplayHostImpl::StartPostponedWebUI() { | 1015 void LoginDisplayHostImpl::StartPostponedWebUI() { |
| 1029 if (!is_wallpaper_loaded_) { | 1016 if (!is_wallpaper_loaded_) { |
| 1030 NOTREACHED(); | 1017 NOTREACHED(); |
| 1031 return; | 1018 return; |
| 1032 } | 1019 } |
| 1033 VLOG(1) << "Login WebUI >> Init postponed WebUI"; | 1020 VLOG(1) << "Login WebUI >> Init postponed WebUI"; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 | 1302 |
| 1316 locale_util::SwitchLanguageCallback callback( | 1303 locale_util::SwitchLanguageCallback callback( |
| 1317 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); | 1304 base::Bind(&OnLanguageSwitchedCallback, base::Passed(data.Pass()))); |
| 1318 | 1305 |
| 1319 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1306 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1320 locale_util::SwitchLanguage( | 1307 locale_util::SwitchLanguage( |
| 1321 locale, true, true /* login_layouts_only */, callback); | 1308 locale, true, true /* login_layouts_only */, callback); |
| 1322 } | 1309 } |
| 1323 | 1310 |
| 1324 } // namespace chromeos | 1311 } // namespace chromeos |
| OLD | NEW |