| 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/chromeos/login/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/desktop_background/desktop_background_controller.h" | 9 #include "ash/desktop_background/desktop_background_controller.h" |
| 10 #include "ash/desktop_background/user_wallpaper_delegate.h" | 10 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 13 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browser_shutdown.h" | 24 #include "chrome/browser/browser_shutdown.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 26 #include "chrome/browser/chromeos/customization_document.h" | 27 #include "chrome/browser/chromeos/customization_document.h" |
| 27 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 28 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 28 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 29 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 29 #include "chrome/browser/chromeos/language_preferences.h" | 30 #include "chrome/browser/chromeos/language_preferences.h" |
| 30 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 31 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 31 #include "chrome/browser/chromeos/login/helper.h" | 32 #include "chrome/browser/chromeos/login/helper.h" |
| 32 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 33 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 33 #include "chrome/browser/chromeos/login/login_utils.h" | 34 #include "chrome/browser/chromeos/login/login_utils.h" |
| 34 #include "chrome/browser/chromeos/login/login_wizard.h" | 35 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 35 #include "chrome/browser/chromeos/login/oobe_display.h" | 36 #include "chrome/browser/chromeos/login/oobe_display.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 79 |
| 79 // URL which corresponds to the login WebUI. | 80 // URL which corresponds to the login WebUI. |
| 80 const char kLoginURL[] = "chrome://oobe/login"; | 81 const char kLoginURL[] = "chrome://oobe/login"; |
| 81 | 82 |
| 82 // URL which corresponds to the OOBE WebUI. | 83 // URL which corresponds to the OOBE WebUI. |
| 83 const char kOobeURL[] = "chrome://oobe/oobe"; | 84 const char kOobeURL[] = "chrome://oobe/oobe"; |
| 84 | 85 |
| 85 // URL which corresponds to the user adding WebUI. | 86 // URL which corresponds to the user adding WebUI. |
| 86 const char kUserAddingURL[] = "chrome://oobe/user-adding"; | 87 const char kUserAddingURL[] = "chrome://oobe/user-adding"; |
| 87 | 88 |
| 89 // URL which corresponds to the app launch splash WebUI. |
| 90 const char kAppLaunchSplashURL[] = "chrome://oobe/app-launch-splash"; |
| 91 |
| 88 // Duration of sign-in transition animation. | 92 // Duration of sign-in transition animation. |
| 89 const int kLoginFadeoutTransitionDurationMs = 700; | 93 const int kLoginFadeoutTransitionDurationMs = 700; |
| 90 | 94 |
| 91 // Number of times we try to reload OOBE/login WebUI if it crashes. | 95 // Number of times we try to reload OOBE/login WebUI if it crashes. |
| 92 const int kCrashCountLimit = 5; | 96 const int kCrashCountLimit = 5; |
| 93 | 97 |
| 94 // Whether to enable tnitializing WebUI in hidden state (see | 98 // Whether to enable tnitializing WebUI in hidden state (see |
| 95 // |initialize_webui_hidden_|) by default. | 99 // |initialize_webui_hidden_|) by default. |
| 96 const bool kHiddenWebUIInitializationDefault = true; | 100 const bool kHiddenWebUIInitializationDefault = true; |
| 97 | 101 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 webui_login_display_->OnPreferencesChanged(); | 506 webui_login_display_->OnPreferencesChanged(); |
| 503 } | 507 } |
| 504 | 508 |
| 505 void LoginDisplayHostImpl::PrewarmAuthentication() { | 509 void LoginDisplayHostImpl::PrewarmAuthentication() { |
| 506 auth_prewarmer_.reset(new AuthPrewarmer()); | 510 auth_prewarmer_.reset(new AuthPrewarmer()); |
| 507 auth_prewarmer_->PrewarmAuthentication( | 511 auth_prewarmer_->PrewarmAuthentication( |
| 508 base::Bind(&LoginDisplayHostImpl::OnAuthPrewarmDone, | 512 base::Bind(&LoginDisplayHostImpl::OnAuthPrewarmDone, |
| 509 pointer_factory_.GetWeakPtr())); | 513 pointer_factory_.GetWeakPtr())); |
| 510 } | 514 } |
| 511 | 515 |
| 516 void LoginDisplayHostImpl::StartAppLaunch(const std::string& app_id) { |
| 517 LOG(WARNING) << "Login WebUI >> start app launch."; |
| 518 SetStatusAreaVisible(false); |
| 519 if (!login_window_) |
| 520 LoadURL(GURL(kAppLaunchSplashURL)); |
| 521 |
| 522 login_view_->set_should_emit_login_prompt_visible(false); |
| 523 |
| 524 app_launch_controller_.reset(new AppLaunchController( |
| 525 app_id, this, GetOobeUI())); |
| 526 |
| 527 app_launch_controller_->StartAppLaunch(); |
| 528 } |
| 529 |
| 512 //////////////////////////////////////////////////////////////////////////////// | 530 //////////////////////////////////////////////////////////////////////////////// |
| 513 // LoginDisplayHostImpl, public | 531 // LoginDisplayHostImpl, public |
| 514 | 532 |
| 515 WizardController* LoginDisplayHostImpl::CreateWizardController() { | 533 WizardController* LoginDisplayHostImpl::CreateWizardController() { |
| 516 // TODO(altimofeev): ensure that WebUI is ready. | 534 // TODO(altimofeev): ensure that WebUI is ready. |
| 517 OobeDisplay* oobe_display = GetOobeUI(); | 535 OobeDisplay* oobe_display = GetOobeUI(); |
| 518 return new WizardController(this, oobe_display); | 536 return new WizardController(this, oobe_display); |
| 519 } | 537 } |
| 520 | 538 |
| 521 void LoginDisplayHostImpl::OnBrowserCreated() { | 539 void LoginDisplayHostImpl::OnBrowserCreated() { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 | 886 |
| 869 // Check whether we need to execute OOBE process. | 887 // Check whether we need to execute OOBE process. |
| 870 bool oobe_complete = chromeos::StartupUtils::IsOobeCompleted(); | 888 bool oobe_complete = chromeos::StartupUtils::IsOobeCompleted(); |
| 871 if (!oobe_complete) { | 889 if (!oobe_complete) { |
| 872 LoginState::Get()->SetLoggedInState( | 890 LoginState::Get()->SetLoggedInState( |
| 873 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); | 891 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); |
| 874 } else { | 892 } else { |
| 875 LoginState::Get()->SetLoggedInState( | 893 LoginState::Get()->SetLoggedInState( |
| 876 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); | 894 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); |
| 877 } | 895 } |
| 896 |
| 897 LoginDisplayHost* display_host = new LoginDisplayHostImpl(screen_bounds); |
| 898 |
| 899 bool show_app_launch_splash_screen = (first_screen_name == |
| 900 chromeos::WizardController::kAppLaunchSplashScreenName); |
| 901 |
| 902 if (show_app_launch_splash_screen) { |
| 903 const std::string& auto_launch_app_id = |
| 904 chromeos::KioskAppManager::Get()->GetAutoLaunchApp(); |
| 905 display_host->StartAppLaunch(auto_launch_app_id); |
| 906 return; |
| 907 } |
| 908 |
| 878 bool show_login_screen = | 909 bool show_login_screen = |
| 879 (first_screen_name.empty() && oobe_complete) || | 910 (first_screen_name.empty() && oobe_complete) || |
| 880 first_screen_name == chromeos::WizardController::kLoginScreenName; | 911 first_screen_name == chromeos::WizardController::kLoginScreenName; |
| 881 | 912 |
| 882 chromeos::LoginDisplayHost* display_host = | |
| 883 new chromeos::LoginDisplayHostImpl(screen_bounds); | |
| 884 | |
| 885 if (show_login_screen) { | 913 if (show_login_screen) { |
| 886 // R11 > R12 migration fix. See http://crosbug.com/p/4898. | 914 // R11 > R12 migration fix. See http://crosbug.com/p/4898. |
| 887 // If user has manually changed locale during R11 OOBE, locale will be set. | 915 // If user has manually changed locale during R11 OOBE, locale will be set. |
| 888 // On R12 > R12|R13 etc. this fix won't get activated since | 916 // On R12 > R12|R13 etc. this fix won't get activated since |
| 889 // OOBE process has set kApplicationLocale to non-default value. | 917 // OOBE process has set kApplicationLocale to non-default value. |
| 890 PrefService* prefs = g_browser_process->local_state(); | 918 PrefService* prefs = g_browser_process->local_state(); |
| 891 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { | 919 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { |
| 892 std::string locale = chromeos::StartupUtils::GetInitialLocale(); | 920 std::string locale = chromeos::StartupUtils::GetInitialLocale(); |
| 893 prefs->SetString(prefs::kApplicationLocale, locale); | 921 prefs->SetString(prefs::kApplicationLocale, locale); |
| 894 manager->EnableLayouts( | 922 manager->EnableLayouts( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 VLOG(1) << "Initial time zone: " << timezone_name; | 988 VLOG(1) << "Initial time zone: " << timezone_name; |
| 961 // Apply locale customizations only once to preserve whatever locale | 989 // Apply locale customizations only once to preserve whatever locale |
| 962 // user has changed to during OOBE. | 990 // user has changed to during OOBE. |
| 963 if (!timezone_name.empty()) { | 991 if (!timezone_name.empty()) { |
| 964 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 992 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 965 UTF8ToUTF16(timezone_name)); | 993 UTF8ToUTF16(timezone_name)); |
| 966 } | 994 } |
| 967 } | 995 } |
| 968 | 996 |
| 969 } // namespace chromeos | 997 } // namespace chromeos |
| OLD | NEW |