Chromium Code Reviews| 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#login"; | 81 const char kLoginURL[] = "chrome://oobe/login#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#login"; | 84 const char kOobeURL[] = "chrome://oobe#login"; |
| 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/login#user-adding"; | 87 const char kUserAddingURL[] = "chrome://oobe/login#user-adding"; |
| 87 | 88 |
| 89 // URL which corresponds to the app launch splash WebUI. | |
| 90 const char kAppLaunchSplashURL[] = "chrome://oobe/login#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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 | 879 |
| 862 // Check whether we need to execute OOBE process. | 880 // Check whether we need to execute OOBE process. |
| 863 bool oobe_complete = chromeos::StartupUtils::IsOobeCompleted(); | 881 bool oobe_complete = chromeos::StartupUtils::IsOobeCompleted(); |
| 864 if (!oobe_complete) { | 882 if (!oobe_complete) { |
| 865 LoginState::Get()->SetLoggedInState( | 883 LoginState::Get()->SetLoggedInState( |
| 866 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); | 884 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); |
| 867 } else { | 885 } else { |
| 868 LoginState::Get()->SetLoggedInState( | 886 LoginState::Get()->SetLoggedInState( |
| 869 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); | 887 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); |
| 870 } | 888 } |
| 889 | |
| 890 chromeos::LoginDisplayHost* display_host = | |
| 891 new chromeos::LoginDisplayHostImpl(screen_bounds); | |
|
xiyuan
2013/08/15 18:19:42
nit: chromeos:: is not needed.
Tim Song
2013/08/16 19:07:59
Done.
| |
| 892 | |
| 893 bool show_app_launch_splash_screen = (first_screen_name == | |
| 894 chromeos::WizardController::kAppLaunchSplashScreenName); | |
| 895 | |
| 896 if (show_app_launch_splash_screen) { | |
| 897 const std::string& auto_launch_app_id = | |
| 898 chromeos::KioskAppManager::Get()->GetAutoLaunchApp(); | |
| 899 display_host->StartAppLaunch(auto_launch_app_id); | |
| 900 return; | |
| 901 } | |
| 902 | |
| 871 bool show_login_screen = | 903 bool show_login_screen = |
| 872 (first_screen_name.empty() && oobe_complete) || | 904 (first_screen_name.empty() && oobe_complete) || |
| 873 first_screen_name == chromeos::WizardController::kLoginScreenName; | 905 first_screen_name == chromeos::WizardController::kLoginScreenName; |
| 874 | 906 |
| 875 chromeos::LoginDisplayHost* display_host = | |
| 876 new chromeos::LoginDisplayHostImpl(screen_bounds); | |
| 877 | |
| 878 if (show_login_screen) { | 907 if (show_login_screen) { |
| 879 // R11 > R12 migration fix. See http://crosbug.com/p/4898. | 908 // R11 > R12 migration fix. See http://crosbug.com/p/4898. |
| 880 // If user has manually changed locale during R11 OOBE, locale will be set. | 909 // If user has manually changed locale during R11 OOBE, locale will be set. |
| 881 // On R12 > R12|R13 etc. this fix won't get activated since | 910 // On R12 > R12|R13 etc. this fix won't get activated since |
| 882 // OOBE process has set kApplicationLocale to non-default value. | 911 // OOBE process has set kApplicationLocale to non-default value. |
| 883 PrefService* prefs = g_browser_process->local_state(); | 912 PrefService* prefs = g_browser_process->local_state(); |
| 884 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { | 913 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { |
| 885 std::string locale = chromeos::StartupUtils::GetInitialLocale(); | 914 std::string locale = chromeos::StartupUtils::GetInitialLocale(); |
| 886 prefs->SetString(prefs::kApplicationLocale, locale); | 915 prefs->SetString(prefs::kApplicationLocale, locale); |
| 887 manager->EnableLayouts( | 916 manager->EnableLayouts( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 VLOG(1) << "Initial time zone: " << timezone_name; | 982 VLOG(1) << "Initial time zone: " << timezone_name; |
| 954 // Apply locale customizations only once to preserve whatever locale | 983 // Apply locale customizations only once to preserve whatever locale |
| 955 // user has changed to during OOBE. | 984 // user has changed to during OOBE. |
| 956 if (!timezone_name.empty()) { | 985 if (!timezone_name.empty()) { |
| 957 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 986 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 958 UTF8ToUTF16(timezone_name)); | 987 UTF8ToUTF16(timezone_name)); |
| 959 } | 988 } |
| 960 } | 989 } |
| 961 | 990 |
| 962 } // namespace chromeos | 991 } // namespace chromeos |
| OLD | NEW |