| Index: chrome/browser/chromeos/login/login_display_host_impl.cc
|
| diff --git a/chrome/browser/chromeos/login/login_display_host_impl.cc b/chrome/browser/chromeos/login/login_display_host_impl.cc
|
| index 7163bb72f8881c921f609738fdcbf73a2957ee48..c4612c2f7cc8d88991fb09a2639b0cf474eec277 100644
|
| --- a/chrome/browser/chromeos/login/login_display_host_impl.cc
|
| +++ b/chrome/browser/chromeos/login/login_display_host_impl.cc
|
| @@ -4,9 +4,12 @@
|
|
|
| #include "chrome/browser/chromeos/login/login_display_host_impl.h"
|
|
|
| +#include "ash/ash_switches.h"
|
| #include "ash/desktop_background/desktop_background_controller.h"
|
| +#include "ash/desktop_background/user_wallpaper_delegate.h"
|
| #include "ash/shell.h"
|
| #include "ash/shell_window_ids.h"
|
| +#include "ash/wm/window_properties.h"
|
| #include "base/bind.h"
|
| #include "base/command_line.h"
|
| #include "base/debug/trace_event.h"
|
| @@ -14,7 +17,9 @@
|
| #include "base/logging.h"
|
| #include "base/prefs/pref_service.h"
|
| #include "base/threading/thread_restrictions.h"
|
| +#include "base/time.h"
|
| #include "base/utf_string_conversions.h"
|
| +#include "base/values.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/browser_shutdown.h"
|
| #include "chrome/browser/chromeos/cros/cros_library.h"
|
| @@ -22,15 +27,18 @@
|
| #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
|
| #include "chrome/browser/chromeos/input_method/input_method_manager.h"
|
| #include "chrome/browser/chromeos/input_method/input_method_util.h"
|
| +#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
|
| #include "chrome/browser/chromeos/language_preferences.h"
|
| #include "chrome/browser/chromeos/login/existing_user_controller.h"
|
| #include "chrome/browser/chromeos/login/helper.h"
|
| #include "chrome/browser/chromeos/login/language_switch_menu.h"
|
| #include "chrome/browser/chromeos/login/login_utils.h"
|
| #include "chrome/browser/chromeos/login/login_wizard.h"
|
| +#include "chrome/browser/chromeos/login/oobe_display.h"
|
| #include "chrome/browser/chromeos/login/startup_utils.h"
|
| #include "chrome/browser/chromeos/login/user_manager.h"
|
| -#include "chrome/browser/chromeos/login/webui_login_display_host.h"
|
| +#include "chrome/browser/chromeos/login/webui_login_display.h"
|
| +#include "chrome/browser/chromeos/login/webui_login_view.h"
|
| #include "chrome/browser/chromeos/login/wizard_controller.h"
|
| #include "chrome/browser/chromeos/mobile_config.h"
|
| #include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
|
| @@ -39,6 +47,7 @@
|
| #include "chrome/browser/lifetime/application_lifetime.h"
|
| #include "chrome/browser/managed_mode/managed_mode.h"
|
| #include "chrome/browser/policy/browser_policy_connector.h"
|
| +#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/pref_names.h"
|
| @@ -47,7 +56,12 @@
|
| #include "chromeos/login/login_state.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_types.h"
|
| +#include "content/public/browser/web_contents.h"
|
| +#include "content/public/browser/web_contents_view.h"
|
| +#include "content/public/browser/web_ui.h"
|
| #include "googleurl/src/gurl.h"
|
| +#include "ui/aura/env.h"
|
| +#include "ui/aura/root_window.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/base/events/event_utils.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| @@ -62,6 +76,26 @@
|
|
|
| namespace {
|
|
|
| +// URL which corresponds to the login WebUI.
|
| +const char kLoginURL[] = "chrome://oobe/login";
|
| +
|
| +// URL which corresponds to the OOBE WebUI.
|
| +const char kOobeURL[] = "chrome://oobe";
|
| +
|
| +// Duration of sign-in transition animation.
|
| +const int kLoginFadeoutTransitionDurationMs = 700;
|
| +
|
| +// Number of times we try to reload OOBE/login WebUI if it crashes.
|
| +const int kCrashCountLimit = 5;
|
| +
|
| +// Whether to enable tnitializing WebUI in hidden state (see
|
| +// |initialize_webui_hidden_|) by default.
|
| +const bool kHiddenWebUIInitializationDefault = true;
|
| +
|
| +// Switch values that might be used to override WebUI init type.
|
| +const char kWebUIInitParallel[] = "parallel";
|
| +const char kWebUIInitPostpone[] = "postpone";
|
| +
|
| // The delay of triggering initialization of the device policy subsystem
|
| // after the login screen is initialized. This makes sure that device policy
|
| // network requests are made while the system is idle waiting for user input.
|
| @@ -122,7 +156,16 @@ LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& background_bounds)
|
| ALLOW_THIS_IN_INITIALIZER_LIST(pointer_factory_(this)),
|
| shutting_down_(false),
|
| oobe_progress_bar_visible_(false),
|
| - session_starting_(false) {
|
| + session_starting_(false),
|
| + login_window_(NULL),
|
| + login_view_(NULL),
|
| + webui_login_display_(NULL),
|
| + is_showing_login_(false),
|
| + is_wallpaper_loaded_(false),
|
| + status_area_saved_visibility_(false),
|
| + crash_count_(0),
|
| + restore_path_(RESTORE_UNKNOWN),
|
| + old_ignore_solo_window_frame_painter_policy_value_(false) {
|
| // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATIN
|
| // because/ APP_TERMINATING will never be fired as long as this keeps
|
| // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no
|
| @@ -148,9 +191,74 @@ LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& background_bounds)
|
|
|
| // Make sure chrome won't exit while we are at login/oobe screen.
|
| chrome::StartKeepAlive();
|
| +
|
| + bool is_registered = StartupUtils::IsDeviceRegistered();
|
| + bool zero_delay_enabled = WizardController::IsZeroDelayEnabled();
|
| + bool disable_boot_animation = CommandLine::ForCurrentProcess()->
|
| + HasSwitch(switches::kDisableBootAnimation);
|
| + bool disable_oobe_animation = CommandLine::ForCurrentProcess()->
|
| + HasSwitch(switches::kDisableOobeAnimation);
|
| +
|
| + waiting_for_wallpaper_load_ =
|
| + !zero_delay_enabled &&
|
| + (is_registered || !disable_oobe_animation) &&
|
| + (!is_registered || !disable_boot_animation);
|
| +
|
| + // For slower hardware we have boot animation disabled so
|
| + // we'll be initializing WebUI hidden, waiting for user pods to load and then
|
| + // show WebUI at once.
|
| + waiting_for_user_pods_ = !zero_delay_enabled && !waiting_for_wallpaper_load_;
|
| +
|
| + initialize_webui_hidden_ =
|
| + kHiddenWebUIInitializationDefault && !zero_delay_enabled;
|
| +
|
| + is_boot_animation2_enabled_ = waiting_for_wallpaper_load_ &&
|
| + !CommandLine::ForCurrentProcess()->HasSwitch(
|
| + ash::switches::kAshDisableBootAnimation2);
|
| +
|
| + // Prevents white flashing on OOBE (http://crbug.com/131569).
|
| + aura::Env::GetInstance()->set_render_white_bg(false);
|
| +
|
| + // Check if WebUI init type is overriden.
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshWebUIInit)) {
|
| + const std::string override_type = CommandLine::ForCurrentProcess()->
|
| + GetSwitchValueASCII(switches::kAshWebUIInit);
|
| + if (override_type == kWebUIInitParallel)
|
| + initialize_webui_hidden_ = true;
|
| + else if (override_type == kWebUIInitPostpone)
|
| + initialize_webui_hidden_ = false;
|
| + }
|
| +
|
| + // Always postpone WebUI initialization on first boot, otherwise we miss
|
| + // initial animation.
|
| + if (!StartupUtils::IsOobeCompleted())
|
| + initialize_webui_hidden_ = false;
|
| +
|
| + // There is no wallpaper for KioskMode, don't initialize the webui hidden.
|
| + if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled())
|
| + initialize_webui_hidden_ = false;
|
| +
|
| + if (waiting_for_wallpaper_load_) {
|
| + registrar_.Add(this, chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED,
|
| + content::NotificationService::AllSources());
|
| + }
|
| +
|
| + // In boot-animation2 we want to show login WebUI as soon as possible.
|
| + if ((waiting_for_user_pods_ || is_boot_animation2_enabled_)
|
| + && initialize_webui_hidden_) {
|
| + registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE,
|
| + content::NotificationService::AllSources());
|
| + }
|
| + LOG(INFO) << "Login WebUI >> "
|
| + << "zero_delay: " << zero_delay_enabled
|
| + << " wait_for_wp_load_: " << waiting_for_wallpaper_load_
|
| + << " wait_for_pods_: " << waiting_for_user_pods_
|
| + << " init_webui_hidden_: " << initialize_webui_hidden_;
|
| }
|
|
|
| LoginDisplayHostImpl::~LoginDisplayHostImpl() {
|
| + ResetLoginWindowAndView();
|
| +
|
| // Let chrome process exit after login/oobe screen if needed.
|
| chrome::EndKeepAlive();
|
|
|
| @@ -160,6 +268,25 @@ LoginDisplayHostImpl::~LoginDisplayHostImpl() {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // LoginDisplayHostImpl, LoginDisplayHost implementation:
|
|
|
| +LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay(
|
| + LoginDisplay::Delegate* delegate) {
|
| + webui_login_display_ = new WebUILoginDisplay(delegate);
|
| + webui_login_display_->set_background_bounds(background_bounds());
|
| + return webui_login_display_;
|
| +}
|
| +
|
| +gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const {
|
| + return login_window_ ? login_window_->GetNativeWindow() : NULL;
|
| +}
|
| +
|
| +WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const {
|
| + return login_view_;
|
| +}
|
| +
|
| +views::Widget* LoginDisplayHostImpl::GetWidget() const {
|
| + return login_window_;
|
| +}
|
| +
|
| void LoginDisplayHostImpl::BeforeSessionStart() {
|
| session_starting_ = true;
|
| }
|
| @@ -183,9 +310,63 @@ void LoginDisplayHostImpl::OnCompleteLogin() {
|
| auto_enrollment_client_.release()->CancelAndDeleteSoon();
|
| }
|
|
|
| +void LoginDisplayHostImpl::OpenProxySettings() {
|
| + if (login_view_)
|
| + login_view_->OpenProxySettings();
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::SetOobeProgressBarVisible(bool visible) {
|
| + GetOobeUI()->ShowOobeUI(visible);
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::SetShutdownButtonEnabled(bool enable) {
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::SetStatusAreaVisible(bool visible) {
|
| + if (initialize_webui_hidden_)
|
| + status_area_saved_visibility_ = visible;
|
| + else if (login_view_)
|
| + login_view_->SetStatusAreaVisible(visible);
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::CheckForAutoEnrollment() {
|
| + // This method is called when the controller determines that the
|
| + // auto-enrollment check can start. This happens either after the EULA is
|
| + // accepted, or right after a reboot if the EULA has already been accepted.
|
| +
|
| + if (policy::AutoEnrollmentClient::IsDisabled()) {
|
| + VLOG(1) << "CheckForAutoEnrollment: auto-enrollment disabled";
|
| + return;
|
| + }
|
| +
|
| + // Start by checking if the device has already been owned.
|
| + pointer_factory_.InvalidateWeakPtrs();
|
| + DeviceSettingsService::Get()->GetOwnershipStatusAsync(
|
| + base::Bind(&LoginDisplayHostImpl::OnOwnershipStatusCheckDone,
|
| + pointer_factory_.GetWeakPtr()));
|
| +}
|
| +
|
| void LoginDisplayHostImpl::StartWizard(
|
| const std::string& first_screen_name,
|
| - DictionaryValue* screen_parameters) {
|
| + scoped_ptr<DictionaryValue> screen_parameters) {
|
| + // Keep parameters to restore if renderer crashes.
|
| + restore_path_ = RESTORE_WIZARD;
|
| + wizard_first_screen_name_ = first_screen_name;
|
| + if (screen_parameters.get())
|
| + wizard_screen_parameters_.reset(screen_parameters->DeepCopy());
|
| + else
|
| + wizard_screen_parameters_.reset();
|
| + is_showing_login_ = false;
|
| +
|
| + if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) {
|
| + LOG(INFO) << "Login WebUI >> wizard postponed";
|
| + return;
|
| + }
|
| + LOG(INFO) << "Login WebUI >> wizard";
|
| +
|
| + if (!login_window_)
|
| + LoadURL(GURL(kOobeURL));
|
| +
|
| DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name;
|
| // Create and show the wizard.
|
| // Note, dtor of the old WizardController should be called before ctor of the
|
| @@ -196,10 +377,26 @@ void LoginDisplayHostImpl::StartWizard(
|
|
|
| oobe_progress_bar_visible_ = !StartupUtils::IsDeviceRegistered();
|
| SetOobeProgressBarVisible(oobe_progress_bar_visible_);
|
| - wizard_controller_->Init(first_screen_name, screen_parameters);
|
| + wizard_controller_->Init(first_screen_name, screen_parameters.Pass());
|
| +}
|
| +
|
| +WizardController* LoginDisplayHostImpl::GetWizardController() {
|
| + return wizard_controller_.get();
|
| }
|
|
|
| void LoginDisplayHostImpl::StartSignInScreen() {
|
| + restore_path_ = RESTORE_SIGN_IN;
|
| + is_showing_login_ = true;
|
| +
|
| + if (waiting_for_wallpaper_load_ && !initialize_webui_hidden_) {
|
| + LOG(INFO) << "Login WebUI >> sign in postponed";
|
| + return;
|
| + }
|
| + LOG(INFO) << "Login WebUI >> sign in";
|
| +
|
| + if (!login_window_)
|
| + LoadURL(GURL(kLoginURL));
|
| +
|
| DVLOG(1) << "Starting sign in screen";
|
| const chromeos::UserList& users = chromeos::UserManager::Get()->GetUsers();
|
|
|
| @@ -234,10 +431,11 @@ void LoginDisplayHostImpl::StartSignInScreen() {
|
| // Initiate device policy fetching.
|
| g_browser_process->browser_policy_connector()->ScheduleServiceInitialization(
|
| kPolicyServiceInitializationDelayMilliseconds);
|
| -}
|
|
|
| -WizardController* LoginDisplayHostImpl::GetWizardController() {
|
| - return wizard_controller_.get();
|
| + CHECK(webui_login_display_);
|
| + GetOobeUI()->ShowSigninScreen(webui_login_display_, webui_login_display_);
|
| + if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled())
|
| + SetStatusAreaVisible(false);
|
| }
|
|
|
| void LoginDisplayHostImpl::ResumeSignInScreen() {
|
| @@ -252,21 +450,30 @@ void LoginDisplayHostImpl::ResumeSignInScreen() {
|
| sign_in_controller_->ResumeLogin();
|
| }
|
|
|
| -void LoginDisplayHostImpl::CheckForAutoEnrollment() {
|
| - // This method is called when the controller determines that the
|
| - // auto-enrollment check can start. This happens either after the EULA is
|
| - // accepted, or right after a reboot if the EULA has already been accepted.
|
|
|
| - if (policy::AutoEnrollmentClient::IsDisabled()) {
|
| - VLOG(1) << "CheckForAutoEnrollment: auto-enrollment disabled";
|
| - return;
|
| - }
|
| +void LoginDisplayHostImpl::OnPreferencesChanged() {
|
| + if (is_showing_login_)
|
| + webui_login_display_->OnPreferencesChanged();
|
| +}
|
|
|
| - // Start by checking if the device has already been owned.
|
| - pointer_factory_.InvalidateWeakPtrs();
|
| - DeviceSettingsService::Get()->GetOwnershipStatusAsync(
|
| - base::Bind(&LoginDisplayHostImpl::OnOwnershipStatusCheckDone,
|
| - pointer_factory_.GetWeakPtr()));
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// LoginDisplayHostImpl, public
|
| +
|
| +WizardController* LoginDisplayHostImpl::CreateWizardController() {
|
| + // TODO(altimofeev): ensure that WebUI is ready.
|
| + OobeDisplay* oobe_display = GetOobeUI();
|
| + return new WizardController(this, oobe_display);
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::OnBrowserCreated() {
|
| + // Close lock window now so that the launched browser can receive focus.
|
| + ResetLoginWindowAndView();
|
| +}
|
| +
|
| +OobeUI* LoginDisplayHostImpl::GetOobeUI() const {
|
| + if (!login_view_)
|
| + return NULL;
|
| + return static_cast<OobeUI*>(login_view_->GetWebUI()->GetController());
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -276,7 +483,38 @@ void LoginDisplayHostImpl::Observe(
|
| int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
| - if (type == chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST) {
|
| + if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) {
|
| + LOG(INFO) << "Login WebUI >> wp animation done";
|
| + is_wallpaper_loaded_ = true;
|
| + ash::Shell::GetInstance()->user_wallpaper_delegate()->
|
| + OnWallpaperBootAnimationFinished();
|
| + if (waiting_for_wallpaper_load_) {
|
| + // StartWizard / StartSignInScreen could be called multiple times through
|
| + // the lifetime of host.
|
| + // Make sure that subsequent calls are not postponed.
|
| + waiting_for_wallpaper_load_ = false;
|
| + if (initialize_webui_hidden_)
|
| + ShowWebUI();
|
| + else
|
| + StartPostponedWebUI();
|
| + }
|
| + registrar_.Remove(this,
|
| + chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED,
|
| + content::NotificationService::AllSources());
|
| + } else if (chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE == type) {
|
| + LOG(INFO) << "Login WebUI >> WEBUI_VISIBLE";
|
| + if (waiting_for_user_pods_ && initialize_webui_hidden_) {
|
| + waiting_for_user_pods_ = false;
|
| + ShowWebUI();
|
| + } else if (waiting_for_wallpaper_load_ && initialize_webui_hidden_) {
|
| + // Reduce time till login UI is shown - show it as soon as possible.
|
| + waiting_for_wallpaper_load_ = false;
|
| + ShowWebUI();
|
| + }
|
| + registrar_.Remove(this,
|
| + chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE,
|
| + content::NotificationService::AllSources());
|
| + } else if (type == chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST) {
|
| ShutdownDisplayHost(true);
|
| } else if (type == chrome::NOTIFICATION_BROWSER_OPENED && session_starting_) {
|
| // Browsers created before session start (windows opened by extensions, for
|
| @@ -300,6 +538,30 @@ void LoginDisplayHostImpl::Observe(
|
| }
|
| }
|
|
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// LoginDisplayHostImpl, WebContentsObserver implementation:
|
| +
|
| +void LoginDisplayHostImpl::RenderViewGone(base::TerminationStatus status) {
|
| + // Do not try to restore on shutdown
|
| + if (browser_shutdown::GetShutdownType() != browser_shutdown::NOT_VALID)
|
| + return;
|
| +
|
| + crash_count_++;
|
| + if (crash_count_ > kCrashCountLimit)
|
| + return;
|
| +
|
| + if (status != base::TERMINATION_STATUS_NORMAL_TERMINATION) {
|
| + // Render with login screen crashed. Let's crash browser process to let
|
| + // session manager restart it properly. It is hard to reload the page
|
| + // and get to controlled state that is fully functional.
|
| + // If you see check, search for renderer crash for the same client.
|
| + LOG(FATAL) << "Renderer crash on login window";
|
| + }
|
| +}
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// LoginDisplayHostImpl, private
|
| +
|
| void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) {
|
| if (shutting_down_)
|
| return;
|
| @@ -371,6 +633,129 @@ void LoginDisplayHostImpl::ForceAutoEnrollment() {
|
| sign_in_controller_->DoAutoEnrollment();
|
| }
|
|
|
| +void LoginDisplayHostImpl::LoadURL(const GURL& url) {
|
| + InitLoginWindowAndView();
|
| + // Subscribe to crash events.
|
| + content::WebContentsObserver::Observe(login_view_->GetWebContents());
|
| + login_view_->LoadURL(url);
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::ShowWebUI() {
|
| + if (!login_window_ || !login_view_) {
|
| + NOTREACHED();
|
| + return;
|
| + }
|
| + LOG(INFO) << "Login WebUI >> Show already initialized UI";
|
| + login_window_->Show();
|
| + login_view_->GetWebContents()->GetView()->Focus();
|
| + login_view_->SetStatusAreaVisible(status_area_saved_visibility_);
|
| + login_view_->OnPostponedShow();
|
| + // We should reset this flag to allow changing of status area visibility.
|
| + initialize_webui_hidden_ = false;
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::StartPostponedWebUI() {
|
| + if (!is_wallpaper_loaded_) {
|
| + NOTREACHED();
|
| + return;
|
| + }
|
| + LOG(INFO) << "Login WebUI >> Init postponed WebUI";
|
| +
|
| + // Wallpaper has finished loading before StartWizard/StartSignInScreen has
|
| + // been called. In general this should not happen.
|
| + // Let go through normal code path when one of those will be called.
|
| + if (restore_path_ == RESTORE_UNKNOWN) {
|
| + NOTREACHED();
|
| + return;
|
| + }
|
| +
|
| + switch (restore_path_) {
|
| + case RESTORE_WIZARD:
|
| + StartWizard(wizard_first_screen_name_,
|
| + wizard_screen_parameters_.Pass());
|
| + break;
|
| + case RESTORE_SIGN_IN:
|
| + StartSignInScreen();
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + break;
|
| + }
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::InitLoginWindowAndView() {
|
| + if (login_window_)
|
| + return;
|
| +
|
| + views::Widget::InitParams params(
|
| + views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
|
| + params.bounds = background_bounds();
|
| + params.show_state = ui::SHOW_STATE_FULLSCREEN;
|
| + params.transparent = true;
|
| + params.parent =
|
| + ash::Shell::GetContainer(
|
| + ash::Shell::GetPrimaryRootWindow(),
|
| + ash::internal::kShellWindowId_LockScreenContainer);
|
| +
|
| + login_window_ = new views::Widget;
|
| + login_window_->Init(params);
|
| + if (login_window_->GetNativeWindow()) {
|
| + aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow();
|
| + if (root) {
|
| + old_ignore_solo_window_frame_painter_policy_value_ =
|
| + root->GetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy);
|
| + root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy,
|
| + true);
|
| + }
|
| + }
|
| + login_view_ = new WebUILoginView();
|
| +
|
| + login_view_->Init(login_window_);
|
| +
|
| + views::corewm::SetWindowVisibilityAnimationDuration(
|
| + login_window_->GetNativeView(),
|
| + base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
|
| + views::corewm::SetWindowVisibilityAnimationTransition(
|
| + login_window_->GetNativeView(),
|
| + views::corewm::ANIMATE_HIDE);
|
| +
|
| + login_window_->SetContentsView(login_view_);
|
| + login_view_->UpdateWindowType();
|
| +
|
| + // If WebUI is initialized in hidden state, show it only if we're no
|
| + // longer waiting for wallpaper animation/user images loading. Otherwise,
|
| + // always show it.
|
| + if (!initialize_webui_hidden_ ||
|
| + (!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) {
|
| + LOG(INFO) << "Login WebUI >> show login wnd on create";
|
| + login_window_->Show();
|
| + } else {
|
| + LOG(INFO) << "Login WebUI >> login wnd is hidden on create";
|
| + login_view_->set_is_hidden(true);
|
| + }
|
| + login_window_->GetNativeView()->SetName("WebUILoginView");
|
| + login_view_->OnWindowCreated();
|
| +}
|
| +
|
| +void LoginDisplayHostImpl::ResetLoginWindowAndView() {
|
| + if (!login_window_)
|
| + return;
|
| +
|
| + if (login_window_->GetNativeWindow()) {
|
| + aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow();
|
| + if (root) {
|
| + root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy,
|
| + old_ignore_solo_window_frame_painter_policy_value_);
|
| + }
|
| + }
|
| + login_window_->Close();
|
| + login_window_ = NULL;
|
| + login_view_ = NULL;
|
| +}
|
| +
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// external
|
| +
|
| // Declared in login_wizard.h so that others don't need to depend on our .h.
|
| // TODO(nkostylev): Split this into a smaller functions.
|
| void ShowLoginWizard(const std::string& first_screen_name,
|
| @@ -432,7 +817,7 @@ void ShowLoginWizard(const std::string& first_screen_name,
|
| first_screen_name == chromeos::WizardController::kLoginScreenName;
|
|
|
| chromeos::LoginDisplayHost* display_host;
|
| - display_host = new chromeos::WebUILoginDisplayHost(screen_bounds);
|
| + display_host = new chromeos::LoginDisplayHostImpl(screen_bounds);
|
|
|
| if (show_login_screen) {
|
| // R11 > R12 migration fix. See http://crosbug.com/p/4898.
|
| @@ -500,7 +885,8 @@ void ShowLoginWizard(const std::string& first_screen_name,
|
| }
|
| }
|
|
|
| - display_host->StartWizard(first_screen_name, NULL);
|
| + scoped_ptr<DictionaryValue> params;
|
| + display_host->StartWizard(first_screen_name, params.Pass());
|
|
|
| chromeos::LoginUtils::Get()->PrewarmAuthentication();
|
| chromeos::DBusThreadManager::Get()->GetSessionManagerClient()
|
|
|