| 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/ash_switches.h" | |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 9 #include "ash/desktop_background/desktop_background_controller.h" |
| 11 #include "ash/desktop_background/user_wallpaper_delegate.h" | 10 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 12 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 13 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 14 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
| 15 #include "base/bind.h" | 14 #include "base/bind.h" |
| 16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 17 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
| 18 #include "base/logging.h" | 17 #include "base/logging.h" |
| 19 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 (!is_registered || !disable_boot_animation); | 210 (!is_registered || !disable_boot_animation); |
| 212 | 211 |
| 213 // For slower hardware we have boot animation disabled so | 212 // For slower hardware we have boot animation disabled so |
| 214 // we'll be initializing WebUI hidden, waiting for user pods to load and then | 213 // we'll be initializing WebUI hidden, waiting for user pods to load and then |
| 215 // show WebUI at once. | 214 // show WebUI at once. |
| 216 waiting_for_user_pods_ = !zero_delay_enabled && !waiting_for_wallpaper_load_; | 215 waiting_for_user_pods_ = !zero_delay_enabled && !waiting_for_wallpaper_load_; |
| 217 | 216 |
| 218 initialize_webui_hidden_ = | 217 initialize_webui_hidden_ = |
| 219 kHiddenWebUIInitializationDefault && !zero_delay_enabled; | 218 kHiddenWebUIInitializationDefault && !zero_delay_enabled; |
| 220 | 219 |
| 221 is_boot_animation2_enabled_ = waiting_for_wallpaper_load_ && | |
| 222 !CommandLine::ForCurrentProcess()->HasSwitch( | |
| 223 ash::switches::kAshDisableBootAnimation2); | |
| 224 | |
| 225 // Prevents white flashing on OOBE (http://crbug.com/131569). | 220 // Prevents white flashing on OOBE (http://crbug.com/131569). |
| 226 aura::Env::GetInstance()->set_render_white_bg(false); | 221 aura::Env::GetInstance()->set_render_white_bg(false); |
| 227 | 222 |
| 228 // Check if WebUI init type is overriden. | 223 // Check if WebUI init type is overriden. |
| 229 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshWebUIInit)) { | 224 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshWebUIInit)) { |
| 230 const std::string override_type = CommandLine::ForCurrentProcess()-> | 225 const std::string override_type = CommandLine::ForCurrentProcess()-> |
| 231 GetSwitchValueASCII(switches::kAshWebUIInit); | 226 GetSwitchValueASCII(switches::kAshWebUIInit); |
| 232 if (override_type == kWebUIInitParallel) | 227 if (override_type == kWebUIInitParallel) |
| 233 initialize_webui_hidden_ = true; | 228 initialize_webui_hidden_ = true; |
| 234 else if (override_type == kWebUIInitPostpone) | 229 else if (override_type == kWebUIInitPostpone) |
| 235 initialize_webui_hidden_ = false; | 230 initialize_webui_hidden_ = false; |
| 236 } | 231 } |
| 237 | 232 |
| 238 // Always postpone WebUI initialization on first boot, otherwise we miss | 233 // Always postpone WebUI initialization on first boot, otherwise we miss |
| 239 // initial animation. | 234 // initial animation. |
| 240 if (!StartupUtils::IsOobeCompleted()) | 235 if (!StartupUtils::IsOobeCompleted()) |
| 241 initialize_webui_hidden_ = false; | 236 initialize_webui_hidden_ = false; |
| 242 | 237 |
| 243 // There is no wallpaper for KioskMode, don't initialize the webui hidden. | 238 // There is no wallpaper for KioskMode, don't initialize the webui hidden. |
| 244 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) | 239 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 245 initialize_webui_hidden_ = false; | 240 initialize_webui_hidden_ = false; |
| 246 | 241 |
| 247 if (waiting_for_wallpaper_load_) { | 242 if (waiting_for_wallpaper_load_) { |
| 248 registrar_.Add(this, chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 243 registrar_.Add(this, chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
| 249 content::NotificationService::AllSources()); | 244 content::NotificationService::AllSources()); |
| 250 } | 245 } |
| 251 | 246 |
| 252 // In boot-animation2 we want to show login WebUI as soon as possible. | 247 // When we wait for WebUI to be initialized we wait for one of |
| 253 if ((waiting_for_user_pods_ || is_boot_animation2_enabled_) | 248 // these notifications. |
| 254 && initialize_webui_hidden_) { | 249 if (waiting_for_user_pods_ && initialize_webui_hidden_) { |
| 255 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, | 250 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, |
| 256 content::NotificationService::AllSources()); | 251 content::NotificationService::AllSources()); |
| 257 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, | 252 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, |
| 258 content::NotificationService::AllSources()); | 253 content::NotificationService::AllSources()); |
| 259 } | 254 } |
| 260 LOG(INFO) << "Login WebUI >> " | 255 LOG(INFO) << "Login WebUI >> " |
| 261 << "zero_delay: " << zero_delay_enabled | 256 << "zero_delay: " << zero_delay_enabled |
| 262 << " wait_for_wp_load_: " << waiting_for_wallpaper_load_ | 257 << " wait_for_wp_load_: " << waiting_for_wallpaper_load_ |
| 263 << " wait_for_pods_: " << waiting_for_user_pods_ | 258 << " wait_for_pods_: " << waiting_for_user_pods_ |
| 264 << " init_webui_hidden_: " << initialize_webui_hidden_; | 259 << " init_webui_hidden_: " << initialize_webui_hidden_; |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 login_window_->Close(); | 767 login_window_->Close(); |
| 773 login_window_ = NULL; | 768 login_window_ = NULL; |
| 774 login_view_ = NULL; | 769 login_view_ = NULL; |
| 775 } | 770 } |
| 776 | 771 |
| 777 //////////////////////////////////////////////////////////////////////////////// | 772 //////////////////////////////////////////////////////////////////////////////// |
| 778 // external | 773 // external |
| 779 | 774 |
| 780 // Declared in login_wizard.h so that others don't need to depend on our .h. | 775 // Declared in login_wizard.h so that others don't need to depend on our .h. |
| 781 // TODO(nkostylev): Split this into a smaller functions. | 776 // TODO(nkostylev): Split this into a smaller functions. |
| 782 void ShowLoginWizard(const std::string& first_screen_name, | 777 void ShowLoginWizard(const std::string& first_screen_name) { |
| 783 const gfx::Size& size) { | |
| 784 if (browser_shutdown::IsTryingToQuit()) | 778 if (browser_shutdown::IsTryingToQuit()) |
| 785 return; | 779 return; |
| 786 | 780 |
| 787 // Managed mode is defined as a machine-level setting so we have to reset it | 781 // Managed mode is defined as a machine-level setting so we have to reset it |
| 788 // each time login screen is shown. See also http://crbug.com/167642 | 782 // each time login screen is shown. See also http://crbug.com/167642 |
| 789 // TODO(nkostylev): Remove this call when managed mode scope is | 783 // TODO(nkostylev): Remove this call when managed mode scope is |
| 790 // limited to user session. | 784 // limited to user session. |
| 791 if (ManagedMode::IsInManagedMode()) | 785 if (ManagedMode::IsInManagedMode()) |
| 792 ManagedMode::LeaveManagedMode(); | 786 ManagedMode::LeaveManagedMode(); |
| 793 | 787 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 815 // login screen. | 809 // login screen. |
| 816 system::mouse_settings::SetPrimaryButtonRight( | 810 system::mouse_settings::SetPrimaryButtonRight( |
| 817 prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight)); | 811 prefs->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight)); |
| 818 system::touchpad_settings::SetTapToClick( | 812 system::touchpad_settings::SetTapToClick( |
| 819 prefs->GetBoolean(prefs::kOwnerTapToClickEnabled)); | 813 prefs->GetBoolean(prefs::kOwnerTapToClickEnabled)); |
| 820 } | 814 } |
| 821 | 815 |
| 822 ui::SetNaturalScroll(CommandLine::ForCurrentProcess()->HasSwitch( | 816 ui::SetNaturalScroll(CommandLine::ForCurrentProcess()->HasSwitch( |
| 823 switches::kNaturalScrollDefault)); | 817 switches::kNaturalScrollDefault)); |
| 824 | 818 |
| 825 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(size)); | 819 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
| 826 | 820 |
| 827 // Check whether we need to execute OOBE process. | 821 // Check whether we need to execute OOBE process. |
| 828 bool oobe_complete = chromeos::StartupUtils::IsOobeCompleted(); | 822 bool oobe_complete = chromeos::StartupUtils::IsOobeCompleted(); |
| 829 if (!oobe_complete) { | 823 if (!oobe_complete) { |
| 830 LoginState::Get()->SetLoggedInState( | 824 LoginState::Get()->SetLoggedInState( |
| 831 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); | 825 LoginState::LOGGED_IN_OOBE, LoginState::LOGGED_IN_USER_NONE); |
| 832 } else { | 826 } else { |
| 833 LoginState::Get()->SetLoggedInState( | 827 LoginState::Get()->SetLoggedInState( |
| 834 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); | 828 LoginState::LOGGED_IN_NONE, LoginState::LOGGED_IN_USER_NONE); |
| 835 } | 829 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 VLOG(1) << "Initial time zone: " << timezone_name; | 913 VLOG(1) << "Initial time zone: " << timezone_name; |
| 920 // Apply locale customizations only once to preserve whatever locale | 914 // Apply locale customizations only once to preserve whatever locale |
| 921 // user has changed to during OOBE. | 915 // user has changed to during OOBE. |
| 922 if (!timezone_name.empty()) { | 916 if (!timezone_name.empty()) { |
| 923 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 917 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| 924 UTF8ToUTF16(timezone_name)); | 918 UTF8ToUTF16(timezone_name)); |
| 925 } | 919 } |
| 926 } | 920 } |
| 927 | 921 |
| 928 } // namespace chromeos | 922 } // namespace chromeos |
| OLD | NEW |