| 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 "ash/ash_switches.h" |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 8 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "ash/wm/window_properties.h" |
| 10 #include "base/bind.h" | 13 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 12 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
| 13 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 14 #include "base/logging.h" | 17 #include "base/logging.h" |
| 15 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 16 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 20 #include "base/time.h" |
| 17 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "base/values.h" |
| 18 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/browser_shutdown.h" | 24 #include "chrome/browser/browser_shutdown.h" |
| 20 #include "chrome/browser/chromeos/cros/cros_library.h" | 25 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 21 #include "chrome/browser/chromeos/customization_document.h" | 26 #include "chrome/browser/chromeos/customization_document.h" |
| 22 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 27 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 23 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 28 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 24 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 29 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 30 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 25 #include "chrome/browser/chromeos/language_preferences.h" | 31 #include "chrome/browser/chromeos/language_preferences.h" |
| 26 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 32 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 27 #include "chrome/browser/chromeos/login/helper.h" | 33 #include "chrome/browser/chromeos/login/helper.h" |
| 28 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 34 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 29 #include "chrome/browser/chromeos/login/login_utils.h" | 35 #include "chrome/browser/chromeos/login/login_utils.h" |
| 30 #include "chrome/browser/chromeos/login/login_wizard.h" | 36 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 37 #include "chrome/browser/chromeos/login/oobe_display.h" |
| 31 #include "chrome/browser/chromeos/login/startup_utils.h" | 38 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 32 #include "chrome/browser/chromeos/login/user_manager.h" | 39 #include "chrome/browser/chromeos/login/user_manager.h" |
| 33 #include "chrome/browser/chromeos/login/webui_login_display_host.h" | 40 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 41 #include "chrome/browser/chromeos/login/webui_login_view.h" |
| 34 #include "chrome/browser/chromeos/login/wizard_controller.h" | 42 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 35 #include "chrome/browser/chromeos/mobile_config.h" | 43 #include "chrome/browser/chromeos/mobile_config.h" |
| 36 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" | 44 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" |
| 37 #include "chrome/browser/chromeos/system/input_device_settings.h" | 45 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 38 #include "chrome/browser/chromeos/system/timezone_settings.h" | 46 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 39 #include "chrome/browser/lifetime/application_lifetime.h" | 47 #include "chrome/browser/lifetime/application_lifetime.h" |
| 40 #include "chrome/browser/managed_mode/managed_mode.h" | 48 #include "chrome/browser/managed_mode/managed_mode.h" |
| 41 #include "chrome/browser/policy/browser_policy_connector.h" | 49 #include "chrome/browser/policy/browser_policy_connector.h" |
| 50 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 42 #include "chrome/common/chrome_notification_types.h" | 51 #include "chrome/common/chrome_notification_types.h" |
| 43 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
| 45 #include "chromeos/dbus/dbus_thread_manager.h" | 54 #include "chromeos/dbus/dbus_thread_manager.h" |
| 46 #include "chromeos/dbus/session_manager_client.h" | 55 #include "chromeos/dbus/session_manager_client.h" |
| 47 #include "chromeos/login/login_state.h" | 56 #include "chromeos/login/login_state.h" |
| 48 #include "content/public/browser/notification_service.h" | 57 #include "content/public/browser/notification_service.h" |
| 49 #include "content/public/browser/notification_types.h" | 58 #include "content/public/browser/notification_types.h" |
| 59 #include "content/public/browser/web_contents.h" |
| 60 #include "content/public/browser/web_contents_view.h" |
| 61 #include "content/public/browser/web_ui.h" |
| 50 #include "googleurl/src/gurl.h" | 62 #include "googleurl/src/gurl.h" |
| 63 #include "ui/aura/env.h" |
| 64 #include "ui/aura/root_window.h" |
| 51 #include "ui/aura/window.h" | 65 #include "ui/aura/window.h" |
| 52 #include "ui/base/events/event_utils.h" | 66 #include "ui/base/events/event_utils.h" |
| 53 #include "ui/base/resource/resource_bundle.h" | 67 #include "ui/base/resource/resource_bundle.h" |
| 54 #include "ui/compositor/layer.h" | 68 #include "ui/compositor/layer.h" |
| 55 #include "ui/compositor/layer_animation_element.h" | 69 #include "ui/compositor/layer_animation_element.h" |
| 56 #include "ui/compositor/layer_animation_sequence.h" | 70 #include "ui/compositor/layer_animation_sequence.h" |
| 57 #include "ui/compositor/layer_animator.h" | 71 #include "ui/compositor/layer_animator.h" |
| 58 #include "ui/compositor/scoped_layer_animation_settings.h" | 72 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 59 #include "ui/gfx/rect.h" | 73 #include "ui/gfx/rect.h" |
| 60 #include "ui/gfx/transform.h" | 74 #include "ui/gfx/transform.h" |
| 61 #include "ui/views/widget/widget.h" | 75 #include "ui/views/widget/widget.h" |
| 62 | 76 |
| 63 namespace { | 77 namespace { |
| 64 | 78 |
| 79 // URL which corresponds to the login WebUI. |
| 80 const char kLoginURL[] = "chrome://oobe/login"; |
| 81 |
| 82 // URL which corresponds to the OOBE WebUI. |
| 83 const char kOobeURL[] = "chrome://oobe"; |
| 84 |
| 85 // Duration of sign-in transition animation. |
| 86 const int kLoginFadeoutTransitionDurationMs = 700; |
| 87 |
| 88 // Number of times we try to reload OOBE/login WebUI if it crashes. |
| 89 const int kCrashCountLimit = 5; |
| 90 |
| 91 // Whether to enable tnitializing WebUI in hidden state (see |
| 92 // |initialize_webui_hidden_|) by default. |
| 93 const bool kHiddenWebUIInitializationDefault = true; |
| 94 |
| 95 // Switch values that might be used to override WebUI init type. |
| 96 const char kWebUIInitParallel[] = "parallel"; |
| 97 const char kWebUIInitPostpone[] = "postpone"; |
| 98 |
| 65 // The delay of triggering initialization of the device policy subsystem | 99 // The delay of triggering initialization of the device policy subsystem |
| 66 // after the login screen is initialized. This makes sure that device policy | 100 // after the login screen is initialized. This makes sure that device policy |
| 67 // network requests are made while the system is idle waiting for user input. | 101 // network requests are made while the system is idle waiting for user input. |
| 68 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; | 102 const int64 kPolicyServiceInitializationDelayMilliseconds = 100; |
| 69 | 103 |
| 70 // Determines the hardware keyboard from the given locale code | 104 // Determines the hardware keyboard from the given locale code |
| 71 // and the OEM layout information, and saves it to "Locale State". | 105 // and the OEM layout information, and saves it to "Locale State". |
| 72 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). | 106 // The information will be used in InputMethodUtil::GetHardwareInputMethodId(). |
| 73 void DetermineAndSaveHardwareKeyboard(const std::string& locale, | 107 void DetermineAndSaveHardwareKeyboard(const std::string& locale, |
| 74 const std::string& oem_layout) { | 108 const std::string& oem_layout) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 LoginDisplayHost* LoginDisplayHostImpl::default_host_ = NULL; | 149 LoginDisplayHost* LoginDisplayHostImpl::default_host_ = NULL; |
| 116 | 150 |
| 117 //////////////////////////////////////////////////////////////////////////////// | 151 //////////////////////////////////////////////////////////////////////////////// |
| 118 // LoginDisplayHostImpl, public | 152 // LoginDisplayHostImpl, public |
| 119 | 153 |
| 120 LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& background_bounds) | 154 LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& background_bounds) |
| 121 : background_bounds_(background_bounds), | 155 : background_bounds_(background_bounds), |
| 122 ALLOW_THIS_IN_INITIALIZER_LIST(pointer_factory_(this)), | 156 ALLOW_THIS_IN_INITIALIZER_LIST(pointer_factory_(this)), |
| 123 shutting_down_(false), | 157 shutting_down_(false), |
| 124 oobe_progress_bar_visible_(false), | 158 oobe_progress_bar_visible_(false), |
| 125 session_starting_(false) { | 159 session_starting_(false), |
| 160 login_window_(NULL), |
| 161 login_view_(NULL), |
| 162 webui_login_display_(NULL), |
| 163 is_showing_login_(false), |
| 164 is_wallpaper_loaded_(false), |
| 165 status_area_saved_visibility_(false), |
| 166 crash_count_(0), |
| 167 restore_path_(RESTORE_UNKNOWN), |
| 168 old_ignore_solo_window_frame_painter_policy_value_(false) { |
| 126 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATIN | 169 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATIN |
| 127 // because/ APP_TERMINATING will never be fired as long as this keeps | 170 // because/ APP_TERMINATING will never be fired as long as this keeps |
| 128 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no | 171 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no |
| 129 // browser instance that will block the shutdown. | 172 // browser instance that will block the shutdown. |
| 130 registrar_.Add(this, | 173 registrar_.Add(this, |
| 131 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 174 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| 132 content::NotificationService::AllSources()); | 175 content::NotificationService::AllSources()); |
| 133 | 176 |
| 134 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but | 177 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but |
| 135 // not shown yet. Lock window has to be closed at this point so that | 178 // not shown yet. Lock window has to be closed at this point so that |
| 136 // a browser window exists and the window can acquire input focus. | 179 // a browser window exists and the window can acquire input focus. |
| 137 registrar_.Add(this, | 180 registrar_.Add(this, |
| 138 chrome::NOTIFICATION_BROWSER_OPENED, | 181 chrome::NOTIFICATION_BROWSER_OPENED, |
| 139 content::NotificationService::AllSources()); | 182 content::NotificationService::AllSources()); |
| 140 | 183 |
| 141 // Login screen is moved to lock screen container when user logs in. | 184 // Login screen is moved to lock screen container when user logs in. |
| 142 registrar_.Add(this, | 185 registrar_.Add(this, |
| 143 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 186 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 144 content::NotificationService::AllSources()); | 187 content::NotificationService::AllSources()); |
| 145 | 188 |
| 146 DCHECK(default_host_ == NULL); | 189 DCHECK(default_host_ == NULL); |
| 147 default_host_ = this; | 190 default_host_ = this; |
| 148 | 191 |
| 149 // Make sure chrome won't exit while we are at login/oobe screen. | 192 // Make sure chrome won't exit while we are at login/oobe screen. |
| 150 chrome::StartKeepAlive(); | 193 chrome::StartKeepAlive(); |
| 194 |
| 195 bool is_registered = StartupUtils::IsDeviceRegistered(); |
| 196 bool zero_delay_enabled = WizardController::IsZeroDelayEnabled(); |
| 197 bool disable_boot_animation = CommandLine::ForCurrentProcess()-> |
| 198 HasSwitch(switches::kDisableBootAnimation); |
| 199 bool disable_oobe_animation = CommandLine::ForCurrentProcess()-> |
| 200 HasSwitch(switches::kDisableOobeAnimation); |
| 201 |
| 202 waiting_for_wallpaper_load_ = |
| 203 !zero_delay_enabled && |
| 204 (is_registered || !disable_oobe_animation) && |
| 205 (!is_registered || !disable_boot_animation); |
| 206 |
| 207 // For slower hardware we have boot animation disabled so |
| 208 // we'll be initializing WebUI hidden, waiting for user pods to load and then |
| 209 // show WebUI at once. |
| 210 waiting_for_user_pods_ = !zero_delay_enabled && !waiting_for_wallpaper_load_; |
| 211 |
| 212 initialize_webui_hidden_ = |
| 213 kHiddenWebUIInitializationDefault && !zero_delay_enabled; |
| 214 |
| 215 is_boot_animation2_enabled_ = waiting_for_wallpaper_load_ && |
| 216 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 217 ash::switches::kAshDisableBootAnimation2); |
| 218 |
| 219 // Prevents white flashing on OOBE (http://crbug.com/131569). |
| 220 aura::Env::GetInstance()->set_render_white_bg(false); |
| 221 |
| 222 // Check if WebUI init type is overriden. |
| 223 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshWebUIInit)) { |
| 224 const std::string override_type = CommandLine::ForCurrentProcess()-> |
| 225 GetSwitchValueASCII(switches::kAshWebUIInit); |
| 226 if (override_type == kWebUIInitParallel) |
| 227 initialize_webui_hidden_ = true; |
| 228 else if (override_type == kWebUIInitPostpone) |
| 229 initialize_webui_hidden_ = false; |
| 230 } |
| 231 |
| 232 // Always postpone WebUI initialization on first boot, otherwise we miss |
| 233 // initial animation. |
| 234 if (!StartupUtils::IsOobeCompleted()) |
| 235 initialize_webui_hidden_ = false; |
| 236 |
| 237 // There is no wallpaper for KioskMode, don't initialize the webui hidden. |
| 238 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 239 initialize_webui_hidden_ = false; |
| 240 |
| 241 if (waiting_for_wallpaper_load_) { |
| 242 registrar_.Add(this, chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
| 243 content::NotificationService::AllSources()); |
| 244 } |
| 245 |
| 246 // In boot-animation2 we want to show login WebUI as soon as possible. |
| 247 if ((waiting_for_user_pods_ || is_boot_animation2_enabled_) |
| 248 && initialize_webui_hidden_) { |
| 249 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, |
| 250 content::NotificationService::AllSources()); |
| 251 } |
| 252 LOG(INFO) << "Login WebUI >> " |
| 253 << "zero_delay: " << zero_delay_enabled |
| 254 << " wait_for_wp_load_: " << waiting_for_wallpaper_load_ |
| 255 << " wait_for_pods_: " << waiting_for_user_pods_ |
| 256 << " init_webui_hidden_: " << initialize_webui_hidden_; |
| 151 } | 257 } |
| 152 | 258 |
| 153 LoginDisplayHostImpl::~LoginDisplayHostImpl() { | 259 LoginDisplayHostImpl::~LoginDisplayHostImpl() { |
| 260 ResetLoginWindowAndView(); |
| 261 |
| 154 // Let chrome process exit after login/oobe screen if needed. | 262 // Let chrome process exit after login/oobe screen if needed. |
| 155 chrome::EndKeepAlive(); | 263 chrome::EndKeepAlive(); |
| 156 | 264 |
| 157 default_host_ = NULL; | 265 default_host_ = NULL; |
| 158 } | 266 } |
| 159 | 267 |
| 160 //////////////////////////////////////////////////////////////////////////////// | 268 //////////////////////////////////////////////////////////////////////////////// |
| 161 // LoginDisplayHostImpl, LoginDisplayHost implementation: | 269 // LoginDisplayHostImpl, LoginDisplayHost implementation: |
| 162 | 270 |
| 271 LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay( |
| 272 LoginDisplay::Delegate* delegate) { |
| 273 webui_login_display_ = new WebUILoginDisplay(delegate); |
| 274 webui_login_display_->set_background_bounds(background_bounds()); |
| 275 return webui_login_display_; |
| 276 } |
| 277 |
| 278 gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const { |
| 279 return login_window_ ? login_window_->GetNativeWindow() : NULL; |
| 280 } |
| 281 |
| 282 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { |
| 283 return login_view_; |
| 284 } |
| 285 |
| 286 views::Widget* LoginDisplayHostImpl::GetWidget() const { |
| 287 return login_window_; |
| 288 } |
| 289 |
| 163 void LoginDisplayHostImpl::BeforeSessionStart() { | 290 void LoginDisplayHostImpl::BeforeSessionStart() { |
| 164 session_starting_ = true; | 291 session_starting_ = true; |
| 165 } | 292 } |
| 166 | 293 |
| 167 void LoginDisplayHostImpl::OnSessionStart() { | 294 void LoginDisplayHostImpl::OnSessionStart() { |
| 168 DVLOG(1) << "Session starting"; | 295 DVLOG(1) << "Session starting"; |
| 169 ash::Shell::GetInstance()-> | 296 ash::Shell::GetInstance()-> |
| 170 desktop_background_controller()->MoveDesktopToUnlockedContainer(); | 297 desktop_background_controller()->MoveDesktopToUnlockedContainer(); |
| 171 if (wizard_controller_.get()) | 298 if (wizard_controller_.get()) |
| 172 wizard_controller_->OnSessionStart(); | 299 wizard_controller_->OnSessionStart(); |
| 173 // Display host is deleted once animation is completed | 300 // Display host is deleted once animation is completed |
| 174 // since sign in screen widget has to stay alive. | 301 // since sign in screen widget has to stay alive. |
| 175 StartAnimation(); | 302 StartAnimation(); |
| 176 ShutdownDisplayHost(false); | 303 ShutdownDisplayHost(false); |
| 177 } | 304 } |
| 178 | 305 |
| 179 void LoginDisplayHostImpl::OnCompleteLogin() { | 306 void LoginDisplayHostImpl::OnCompleteLogin() { |
| 180 // Cancelling the |auto_enrollment_client_| now allows it to determine whether | 307 // Cancelling the |auto_enrollment_client_| now allows it to determine whether |
| 181 // its protocol finished before login was complete. | 308 // its protocol finished before login was complete. |
| 182 if (auto_enrollment_client_.get()) | 309 if (auto_enrollment_client_.get()) |
| 183 auto_enrollment_client_.release()->CancelAndDeleteSoon(); | 310 auto_enrollment_client_.release()->CancelAndDeleteSoon(); |
| 184 } | 311 } |
| 185 | 312 |
| 313 void LoginDisplayHostImpl::OpenProxySettings() { |
| 314 if (login_view_) |
| 315 login_view_->OpenProxySettings(); |
| 316 } |
| 317 |
| 318 void LoginDisplayHostImpl::SetOobeProgressBarVisible(bool visible) { |
| 319 GetOobeUI()->ShowOobeUI(visible); |
| 320 } |
| 321 |
| 322 void LoginDisplayHostImpl::SetShutdownButtonEnabled(bool enable) { |
| 323 } |
| 324 |
| 325 void LoginDisplayHostImpl::SetStatusAreaVisible(bool visible) { |
| 326 if (initialize_webui_hidden_) |
| 327 status_area_saved_visibility_ = visible; |
| 328 else if (login_view_) |
| 329 login_view_->SetStatusAreaVisible(visible); |
| 330 } |
| 331 |
| 332 void LoginDisplayHostImpl::CheckForAutoEnrollment() { |
| 333 // This method is called when the controller determines that the |
| 334 // auto-enrollment check can start. This happens either after the EULA is |
| 335 // accepted, or right after a reboot if the EULA has already been accepted. |
| 336 |
| 337 if (policy::AutoEnrollmentClient::IsDisabled()) { |
| 338 VLOG(1) << "CheckForAutoEnrollment: auto-enrollment disabled"; |
| 339 return; |
| 340 } |
| 341 |
| 342 // Start by checking if the device has already been owned. |
| 343 pointer_factory_.InvalidateWeakPtrs(); |
| 344 DeviceSettingsService::Get()->GetOwnershipStatusAsync( |
| 345 base::Bind(&LoginDisplayHostImpl::OnOwnershipStatusCheckDone, |
| 346 pointer_factory_.GetWeakPtr())); |
| 347 } |
| 348 |
| 186 void LoginDisplayHostImpl::StartWizard( | 349 void LoginDisplayHostImpl::StartWizard( |
| 187 const std::string& first_screen_name, | 350 const std::string& first_screen_name, |
| 188 DictionaryValue* screen_parameters) { | 351 scoped_ptr<DictionaryValue> screen_parameters) { |
| 352 // Keep parameters to restore if renderer crashes. |
| 353 restore_path_ = RESTORE_WIZARD; |
| 354 wizard_first_screen_name_ = first_screen_name; |
| 355 if (screen_parameters.get()) |
| 356 wizard_screen_parameters_.reset(screen_parameters->DeepCopy()); |
| 357 else |
| 358 wizard_screen_parameters_.reset(); |
| 359 is_showing_login_ = false; |
| 360 |
| 361 if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) { |
| 362 LOG(INFO) << "Login WebUI >> wizard postponed"; |
| 363 return; |
| 364 } |
| 365 LOG(INFO) << "Login WebUI >> wizard"; |
| 366 |
| 367 if (!login_window_) |
| 368 LoadURL(GURL(kOobeURL)); |
| 369 |
| 189 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; | 370 DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; |
| 190 // Create and show the wizard. | 371 // Create and show the wizard. |
| 191 // Note, dtor of the old WizardController should be called before ctor of the | 372 // Note, dtor of the old WizardController should be called before ctor of the |
| 192 // new one, because "default_controller()" is updated there. So pure "reset()" | 373 // new one, because "default_controller()" is updated there. So pure "reset()" |
| 193 // is done before new controller creation. | 374 // is done before new controller creation. |
| 194 wizard_controller_.reset(); | 375 wizard_controller_.reset(); |
| 195 wizard_controller_.reset(CreateWizardController()); | 376 wizard_controller_.reset(CreateWizardController()); |
| 196 | 377 |
| 197 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered(); | 378 oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered(); |
| 198 SetOobeProgressBarVisible(oobe_progress_bar_visible_); | 379 SetOobeProgressBarVisible(oobe_progress_bar_visible_); |
| 199 wizard_controller_->Init(first_screen_name, screen_parameters); | 380 wizard_controller_->Init(first_screen_name, screen_parameters.Pass()); |
| 381 } |
| 382 |
| 383 WizardController* LoginDisplayHostImpl::GetWizardController() { |
| 384 return wizard_controller_.get(); |
| 200 } | 385 } |
| 201 | 386 |
| 202 void LoginDisplayHostImpl::StartSignInScreen() { | 387 void LoginDisplayHostImpl::StartSignInScreen() { |
| 388 restore_path_ = RESTORE_SIGN_IN; |
| 389 is_showing_login_ = true; |
| 390 |
| 391 if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) { |
| 392 LOG(INFO) << "Login WebUI >> sign in postponed"; |
| 393 return; |
| 394 } |
| 395 LOG(INFO) << "Login WebUI >> sign in"; |
| 396 |
| 397 if (!login_window_) |
| 398 LoadURL(GURL(kLoginURL)); |
| 399 |
| 203 DVLOG(1) << "Starting sign in screen"; | 400 DVLOG(1) << "Starting sign in screen"; |
| 204 const chromeos::UserList& users = chromeos::UserManager::Get()->GetUsers(); | 401 const chromeos::UserList& users = chromeos::UserManager::Get()->GetUsers(); |
| 205 | 402 |
| 206 // Fix for users who updated device and thus never passed register screen. | 403 // Fix for users who updated device and thus never passed register screen. |
| 207 // If we already have users, we assume that it is not a second part of | 404 // If we already have users, we assume that it is not a second part of |
| 208 // OOBE. See http://crosbug.com/6289 | 405 // OOBE. See http://crosbug.com/6289 |
| 209 if (!StartupUtils::IsDeviceRegistered() && !users.empty()) { | 406 if (!StartupUtils::IsDeviceRegistered() && !users.empty()) { |
| 210 VLOG(1) << "Mark device registered because there are remembered users: " | 407 VLOG(1) << "Mark device registered because there are remembered users: " |
| 211 << users.size(); | 408 << users.size(); |
| 212 StartupUtils::MarkDeviceRegistered(); | 409 StartupUtils::MarkDeviceRegistered(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 227 | 424 |
| 228 // Initiate services customization manifest fetching. | 425 // Initiate services customization manifest fetching. |
| 229 ServicesCustomizationDocument::GetInstance()->StartFetching(); | 426 ServicesCustomizationDocument::GetInstance()->StartFetching(); |
| 230 | 427 |
| 231 // Initiate mobile config load. | 428 // Initiate mobile config load. |
| 232 MobileConfig::GetInstance(); | 429 MobileConfig::GetInstance(); |
| 233 | 430 |
| 234 // Initiate device policy fetching. | 431 // Initiate device policy fetching. |
| 235 g_browser_process->browser_policy_connector()->ScheduleServiceInitialization( | 432 g_browser_process->browser_policy_connector()->ScheduleServiceInitialization( |
| 236 kPolicyServiceInitializationDelayMilliseconds); | 433 kPolicyServiceInitializationDelayMilliseconds); |
| 237 } | |
| 238 | 434 |
| 239 WizardController* LoginDisplayHostImpl::GetWizardController() { | 435 CHECK(webui_login_display_); |
| 240 return wizard_controller_.get(); | 436 GetOobeUI()->ShowSigninScreen(webui_login_display_, webui_login_display_); |
| 437 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 438 SetStatusAreaVisible(false); |
| 241 } | 439 } |
| 242 | 440 |
| 243 void LoginDisplayHostImpl::ResumeSignInScreen() { | 441 void LoginDisplayHostImpl::ResumeSignInScreen() { |
| 244 // We only get here after a previous call the StartSignInScreen. That sign-in | 442 // We only get here after a previous call the StartSignInScreen. That sign-in |
| 245 // was successful but was interrupted by an auto-enrollment execution; once | 443 // was successful but was interrupted by an auto-enrollment execution; once |
| 246 // auto-enrollment is complete we resume the normal login flow from here. | 444 // auto-enrollment is complete we resume the normal login flow from here. |
| 247 DVLOG(1) << "Resuming sign in screen"; | 445 DVLOG(1) << "Resuming sign in screen"; |
| 248 CHECK(sign_in_controller_.get()); | 446 CHECK(sign_in_controller_.get()); |
| 249 SetOobeProgressBarVisible(oobe_progress_bar_visible_); | 447 SetOobeProgressBarVisible(oobe_progress_bar_visible_); |
| 250 SetStatusAreaVisible(true); | 448 SetStatusAreaVisible(true); |
| 251 SetShutdownButtonEnabled(true); | 449 SetShutdownButtonEnabled(true); |
| 252 sign_in_controller_->ResumeLogin(); | 450 sign_in_controller_->ResumeLogin(); |
| 253 } | 451 } |
| 254 | 452 |
| 255 void LoginDisplayHostImpl::CheckForAutoEnrollment() { | |
| 256 // This method is called when the controller determines that the | |
| 257 // auto-enrollment check can start. This happens either after the EULA is | |
| 258 // accepted, or right after a reboot if the EULA has already been accepted. | |
| 259 | 453 |
| 260 if (policy::AutoEnrollmentClient::IsDisabled()) { | 454 void LoginDisplayHostImpl::OnPreferencesChanged() { |
| 261 VLOG(1) << "CheckForAutoEnrollment: auto-enrollment disabled"; | 455 if (is_showing_login_) |
| 262 return; | 456 webui_login_display_->OnPreferencesChanged(); |
| 263 } | |
| 264 | |
| 265 // Start by checking if the device has already been owned. | |
| 266 pointer_factory_.InvalidateWeakPtrs(); | |
| 267 DeviceSettingsService::Get()->GetOwnershipStatusAsync( | |
| 268 base::Bind(&LoginDisplayHostImpl::OnOwnershipStatusCheckDone, | |
| 269 pointer_factory_.GetWeakPtr())); | |
| 270 } | 457 } |
| 271 | 458 |
| 272 //////////////////////////////////////////////////////////////////////////////// | 459 //////////////////////////////////////////////////////////////////////////////// |
| 460 // LoginDisplayHostImpl, public |
| 461 |
| 462 WizardController* LoginDisplayHostImpl::CreateWizardController() { |
| 463 // TODO(altimofeev): ensure that WebUI is ready. |
| 464 OobeDisplay* oobe_display = GetOobeUI(); |
| 465 return new WizardController(this, oobe_display); |
| 466 } |
| 467 |
| 468 void LoginDisplayHostImpl::OnBrowserCreated() { |
| 469 // Close lock window now so that the launched browser can receive focus. |
| 470 ResetLoginWindowAndView(); |
| 471 } |
| 472 |
| 473 OobeUI* LoginDisplayHostImpl::GetOobeUI() const { |
| 474 if (!login_view_) |
| 475 return NULL; |
| 476 return static_cast<OobeUI*>(login_view_->GetWebUI()->GetController()); |
| 477 } |
| 478 |
| 479 //////////////////////////////////////////////////////////////////////////////// |
| 273 // LoginDisplayHostImpl, content:NotificationObserver implementation: | 480 // LoginDisplayHostImpl, content:NotificationObserver implementation: |
| 274 | 481 |
| 275 void LoginDisplayHostImpl::Observe( | 482 void LoginDisplayHostImpl::Observe( |
| 276 int type, | 483 int type, |
| 277 const content::NotificationSource& source, | 484 const content::NotificationSource& source, |
| 278 const content::NotificationDetails& details) { | 485 const content::NotificationDetails& details) { |
| 279 if (type == chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST) { | 486 if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { |
| 487 LOG(INFO) << "Login WebUI >> wp animation done"; |
| 488 is_wallpaper_loaded_ = true; |
| 489 ash::Shell::GetInstance()->user_wallpaper_delegate()-> |
| 490 OnWallpaperBootAnimationFinished(); |
| 491 if (waiting_for_wallpaper_load_) { |
| 492 // StartWizard / StartSignInScreen could be called multiple times through |
| 493 // the lifetime of host. |
| 494 // Make sure that subsequent calls are not postponed. |
| 495 waiting_for_wallpaper_load_ = false; |
| 496 if (initialize_webui_hidden_) |
| 497 ShowWebUI(); |
| 498 else |
| 499 StartPostponedWebUI(); |
| 500 } |
| 501 registrar_.Remove(this, |
| 502 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
| 503 content::NotificationService::AllSources()); |
| 504 } else if (chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE == type) { |
| 505 LOG(INFO) << "Login WebUI >> WEBUI_VISIBLE"; |
| 506 if (waiting_for_user_pods_ && initialize_webui_hidden_) { |
| 507 waiting_for_user_pods_ = false; |
| 508 ShowWebUI(); |
| 509 } else if (waiting_for_wallpaper_load_ && initialize_webui_hidden_) { |
| 510 // Reduce time till login UI is shown - show it as soon as possible. |
| 511 waiting_for_wallpaper_load_ = false; |
| 512 ShowWebUI(); |
| 513 } |
| 514 registrar_.Remove(this, |
| 515 chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, |
| 516 content::NotificationService::AllSources()); |
| 517 } else if (type == chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST) { |
| 280 ShutdownDisplayHost(true); | 518 ShutdownDisplayHost(true); |
| 281 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED && session_starting_) { | 519 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED && session_starting_) { |
| 282 // Browsers created before session start (windows opened by extensions, for | 520 // Browsers created before session start (windows opened by extensions, for |
| 283 // example) are ignored. | 521 // example) are ignored. |
| 284 OnBrowserCreated(); | 522 OnBrowserCreated(); |
| 285 registrar_.Remove(this, | 523 registrar_.Remove(this, |
| 286 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 524 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| 287 content::NotificationService::AllSources()); | 525 content::NotificationService::AllSources()); |
| 288 registrar_.Remove(this, | 526 registrar_.Remove(this, |
| 289 chrome::NOTIFICATION_BROWSER_OPENED, | 527 chrome::NOTIFICATION_BROWSER_OPENED, |
| 290 content::NotificationService::AllSources()); | 528 content::NotificationService::AllSources()); |
| 291 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED && | 529 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED && |
| 292 chromeos::UserManager::Get()->IsCurrentUserNew()) { | 530 chromeos::UserManager::Get()->IsCurrentUserNew()) { |
| 293 // For new user, move desktop to locker container so that windows created | 531 // For new user, move desktop to locker container so that windows created |
| 294 // during the user image picker step are below it. | 532 // during the user image picker step are below it. |
| 295 ash::Shell::GetInstance()-> | 533 ash::Shell::GetInstance()-> |
| 296 desktop_background_controller()->MoveDesktopToLockedContainer(); | 534 desktop_background_controller()->MoveDesktopToLockedContainer(); |
| 297 registrar_.Remove(this, | 535 registrar_.Remove(this, |
| 298 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 536 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 299 content::NotificationService::AllSources()); | 537 content::NotificationService::AllSources()); |
| 300 } | 538 } |
| 301 } | 539 } |
| 302 | 540 |
| 541 //////////////////////////////////////////////////////////////////////////////// |
| 542 // LoginDisplayHostImpl, WebContentsObserver implementation: |
| 543 |
| 544 void LoginDisplayHostImpl::RenderViewGone(base::TerminationStatus status) { |
| 545 // Do not try to restore on shutdown |
| 546 if (browser_shutdown::GetShutdownType() != browser_shutdown::NOT_VALID) |
| 547 return; |
| 548 |
| 549 crash_count_++; |
| 550 if (crash_count_ > kCrashCountLimit) |
| 551 return; |
| 552 |
| 553 if (status != base::TERMINATION_STATUS_NORMAL_TERMINATION) { |
| 554 // Render with login screen crashed. Let's crash browser process to let |
| 555 // session manager restart it properly. It is hard to reload the page |
| 556 // and get to controlled state that is fully functional. |
| 557 // If you see check, search for renderer crash for the same client. |
| 558 LOG(FATAL) << "Renderer crash on login window"; |
| 559 } |
| 560 } |
| 561 |
| 562 //////////////////////////////////////////////////////////////////////////////// |
| 563 // LoginDisplayHostImpl, private |
| 564 |
| 303 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) { | 565 void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) { |
| 304 if (shutting_down_) | 566 if (shutting_down_) |
| 305 return; | 567 return; |
| 306 | 568 |
| 307 shutting_down_ = true; | 569 shutting_down_ = true; |
| 308 registrar_.RemoveAll(); | 570 registrar_.RemoveAll(); |
| 309 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 571 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 310 if (post_quit_task) | 572 if (post_quit_task) |
| 311 MessageLoop::current()->Quit(); | 573 MessageLoop::current()->Quit(); |
| 312 } | 574 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 626 |
| 365 if (auto_enroll) | 627 if (auto_enroll) |
| 366 ForceAutoEnrollment(); | 628 ForceAutoEnrollment(); |
| 367 } | 629 } |
| 368 | 630 |
| 369 void LoginDisplayHostImpl::ForceAutoEnrollment() { | 631 void LoginDisplayHostImpl::ForceAutoEnrollment() { |
| 370 if (sign_in_controller_.get()) | 632 if (sign_in_controller_.get()) |
| 371 sign_in_controller_->DoAutoEnrollment(); | 633 sign_in_controller_->DoAutoEnrollment(); |
| 372 } | 634 } |
| 373 | 635 |
| 636 void LoginDisplayHostImpl::LoadURL(const GURL& url) { |
| 637 InitLoginWindowAndView(); |
| 638 // Subscribe to crash events. |
| 639 content::WebContentsObserver::Observe(login_view_->GetWebContents()); |
| 640 login_view_->LoadURL(url); |
| 641 } |
| 642 |
| 643 void LoginDisplayHostImpl::ShowWebUI() { |
| 644 if (!login_window_ || !login_view_) { |
| 645 NOTREACHED(); |
| 646 return; |
| 647 } |
| 648 LOG(INFO) << "Login WebUI >> Show already initialized UI"; |
| 649 login_window_->Show(); |
| 650 login_view_->GetWebContents()->GetView()->Focus(); |
| 651 login_view_->SetStatusAreaVisible(status_area_saved_visibility_); |
| 652 login_view_->OnPostponedShow(); |
| 653 // We should reset this flag to allow changing of status area visibility. |
| 654 initialize_webui_hidden_ = false; |
| 655 } |
| 656 |
| 657 void LoginDisplayHostImpl::StartPostponedWebUI() { |
| 658 if (!is_wallpaper_loaded_) { |
| 659 NOTREACHED(); |
| 660 return; |
| 661 } |
| 662 LOG(INFO) << "Login WebUI >> Init postponed WebUI"; |
| 663 |
| 664 // Wallpaper has finished loading before StartWizard/StartSignInScreen has |
| 665 // been called. In general this should not happen. |
| 666 // Let go through normal code path when one of those will be called. |
| 667 if (restore_path_ == RESTORE_UNKNOWN) { |
| 668 NOTREACHED(); |
| 669 return; |
| 670 } |
| 671 |
| 672 switch (restore_path_) { |
| 673 case RESTORE_WIZARD: |
| 674 StartWizard(wizard_first_screen_name_, |
| 675 wizard_screen_parameters_.Pass()); |
| 676 break; |
| 677 case RESTORE_SIGN_IN: |
| 678 StartSignInScreen(); |
| 679 break; |
| 680 default: |
| 681 NOTREACHED(); |
| 682 break; |
| 683 } |
| 684 } |
| 685 |
| 686 void LoginDisplayHostImpl::InitLoginWindowAndView() { |
| 687 if (login_window_) |
| 688 return; |
| 689 |
| 690 views::Widget::InitParams params( |
| 691 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
| 692 params.bounds = background_bounds(); |
| 693 params.show_state = ui::SHOW_STATE_FULLSCREEN; |
| 694 params.transparent = true; |
| 695 params.parent = |
| 696 ash::Shell::GetContainer( |
| 697 ash::Shell::GetPrimaryRootWindow(), |
| 698 ash::internal::kShellWindowId_LockScreenContainer); |
| 699 |
| 700 login_window_ = new views::Widget; |
| 701 login_window_->Init(params); |
| 702 if (login_window_->GetNativeWindow()) { |
| 703 aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow(); |
| 704 if (root) { |
| 705 old_ignore_solo_window_frame_painter_policy_value_ = |
| 706 root->GetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy); |
| 707 root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy, |
| 708 true); |
| 709 } |
| 710 } |
| 711 login_view_ = new WebUILoginView(); |
| 712 |
| 713 login_view_->Init(login_window_); |
| 714 |
| 715 views::corewm::SetWindowVisibilityAnimationDuration( |
| 716 login_window_->GetNativeView(), |
| 717 base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs)); |
| 718 views::corewm::SetWindowVisibilityAnimationTransition( |
| 719 login_window_->GetNativeView(), |
| 720 views::corewm::ANIMATE_HIDE); |
| 721 |
| 722 login_window_->SetContentsView(login_view_); |
| 723 login_view_->UpdateWindowType(); |
| 724 |
| 725 // If WebUI is initialized in hidden state, show it only if we're no |
| 726 // longer waiting for wallpaper animation/user images loading. Otherwise, |
| 727 // always show it. |
| 728 if (!initialize_webui_hidden_ || |
| 729 (!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) { |
| 730 LOG(INFO) << "Login WebUI >> show login wnd on create"; |
| 731 login_window_->Show(); |
| 732 } else { |
| 733 LOG(INFO) << "Login WebUI >> login wnd is hidden on create"; |
| 734 login_view_->set_is_hidden(true); |
| 735 } |
| 736 login_window_->GetNativeView()->SetName("WebUILoginView"); |
| 737 login_view_->OnWindowCreated(); |
| 738 } |
| 739 |
| 740 void LoginDisplayHostImpl::ResetLoginWindowAndView() { |
| 741 if (!login_window_) |
| 742 return; |
| 743 |
| 744 if (login_window_->GetNativeWindow()) { |
| 745 aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow(); |
| 746 if (root) { |
| 747 root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy, |
| 748 old_ignore_solo_window_frame_painter_policy_value_); |
| 749 } |
| 750 } |
| 751 login_window_->Close(); |
| 752 login_window_ = NULL; |
| 753 login_view_ = NULL; |
| 754 } |
| 755 |
| 756 //////////////////////////////////////////////////////////////////////////////// |
| 757 // external |
| 758 |
| 374 // Declared in login_wizard.h so that others don't need to depend on our .h. | 759 // Declared in login_wizard.h so that others don't need to depend on our .h. |
| 375 // TODO(nkostylev): Split this into a smaller functions. | 760 // TODO(nkostylev): Split this into a smaller functions. |
| 376 void ShowLoginWizard(const std::string& first_screen_name, | 761 void ShowLoginWizard(const std::string& first_screen_name, |
| 377 const gfx::Size& size) { | 762 const gfx::Size& size) { |
| 378 if (browser_shutdown::IsTryingToQuit()) | 763 if (browser_shutdown::IsTryingToQuit()) |
| 379 return; | 764 return; |
| 380 | 765 |
| 381 // Managed mode is defined as a machine-level setting so we have to reset it | 766 // Managed mode is defined as a machine-level setting so we have to reset it |
| 382 // each time login screen is shown. See also http://crbug.com/167642 | 767 // each time login screen is shown. See also http://crbug.com/167642 |
| 383 // TODO(nkostylev): Remove this call when managed mode scope is | 768 // TODO(nkostylev): Remove this call when managed mode scope is |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); | 810 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); |
| 426 } else { | 811 } else { |
| 427 LoginState::Get()->SetLoggedInState( | 812 LoginState::Get()->SetLoggedInState( |
| 428 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); | 813 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); |
| 429 } | 814 } |
| 430 bool show_login_screen = | 815 bool show_login_screen = |
| 431 (first_screen_name.empty() && oobe_complete) || | 816 (first_screen_name.empty() && oobe_complete) || |
| 432 first_screen_name == chromeos::WizardController::kLoginScreenName; | 817 first_screen_name == chromeos::WizardController::kLoginScreenName; |
| 433 | 818 |
| 434 chromeos::LoginDisplayHost* display_host; | 819 chromeos::LoginDisplayHost* display_host; |
| 435 display_host = new chromeos::WebUILoginDisplayHost(screen_bounds); | 820 display_host = new chromeos::LoginDisplayHostImpl(screen_bounds); |
| 436 | 821 |
| 437 if (show_login_screen) { | 822 if (show_login_screen) { |
| 438 // R11 > R12 migration fix. See http://crosbug.com/p/4898. | 823 // R11 > R12 migration fix. See http://crosbug.com/p/4898. |
| 439 // If user has manually changed locale during R11 OOBE, locale will be set. | 824 // If user has manually changed locale during R11 OOBE, locale will be set. |
| 440 // On R12 > R12|R13 etc. this fix won't get activated since | 825 // On R12 > R12|R13 etc. this fix won't get activated since |
| 441 // OOBE process has set kApplicationLocale to non-default value. | 826 // OOBE process has set kApplicationLocale to non-default value. |
| 442 PrefService* prefs = g_browser_process->local_state(); | 827 PrefService* prefs = g_browser_process->local_state(); |
| 443 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { | 828 if (!prefs->HasPrefPath(prefs::kApplicationLocale)) { |
| 444 std::string locale = chromeos::StartupUtils::GetInitialLocale(); | 829 std::string locale = chromeos::StartupUtils::GetInitialLocale(); |
| 445 prefs->SetString(prefs::kApplicationLocale, locale); | 830 prefs->SetString(prefs::kApplicationLocale, locale); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 const std::string loaded_locale = | 878 const std::string loaded_locale = |
| 494 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); | 879 ResourceBundle::GetSharedInstance().ReloadLocaleResources(locale); |
| 495 CHECK(!loaded_locale.empty()) << "Locale could not be found for " | 880 CHECK(!loaded_locale.empty()) << "Locale could not be found for " |
| 496 << locale; | 881 << locale; |
| 497 // Set the application locale here so that the language switch | 882 // Set the application locale here so that the language switch |
| 498 // menu works properly with the newly loaded locale. | 883 // menu works properly with the newly loaded locale. |
| 499 g_browser_process->SetApplicationLocale(loaded_locale); | 884 g_browser_process->SetApplicationLocale(loaded_locale); |
| 500 } | 885 } |
| 501 } | 886 } |
| 502 | 887 |
| 503 display_host->StartWizard(first_screen_name, NULL); | 888 scoped_ptr<DictionaryValue> params; |
| 889 display_host->StartWizard(first_screen_name, params.Pass()); |
| 504 | 890 |
| 505 chromeos::LoginUtils::Get()->PrewarmAuthentication(); | 891 chromeos::LoginUtils::Get()->PrewarmAuthentication(); |
| 506 chromeos::DBusThreadManager::Get()->GetSessionManagerClient() | 892 chromeos::DBusThreadManager::Get()->GetSessionManagerClient() |
| 507 ->EmitLoginPromptReady(); | 893 ->EmitLoginPromptReady(); |
| 508 TRACE_EVENT0("chromeos", "ShowLoginWizard::EmitLoginPromptReady"); | 894 TRACE_EVENT0("chromeos", "ShowLoginWizard::EmitLoginPromptReady"); |
| 509 | 895 |
| 510 // Set initial timezone if specified by customization. | 896 // Set initial timezone if specified by customization. |
| 511 const std::string timezone_name = startup_manifest->initial_timezone(); | 897 const std::string timezone_name = startup_manifest->initial_timezone(); |
| 512 VLOG(1) << "Initial time zone: " << timezone_name; | 898 VLOG(1) << "Initial time zone: " << timezone_name; |
| 513 // Apply locale customizations only once to preserve whatever locale | 899 // Apply locale customizations only once to preserve whatever locale |
| 514 // user has changed to during OOBE. | 900 // user has changed to during OOBE. |
| 515 if (!timezone_name.empty()) { | 901 if (!timezone_name.empty()) { |
| 516 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 902 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 517 UTF8ToUTF16(timezone_name)); | 903 UTF8ToUTF16(timezone_name)); |
| 518 } | 904 } |
| 519 } | 905 } |
| 520 | 906 |
| 521 } // namespace chromeos | 907 } // namespace chromeos |
| OLD | NEW |