| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/wallpaper/wallpaper_controller.h" | 10 #include "ash/common/wallpaper/wallpaper_controller.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 namespace chromeos { | 264 namespace chromeos { |
| 265 | 265 |
| 266 // static | 266 // static |
| 267 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111; | 267 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111; |
| 268 | 268 |
| 269 //////////////////////////////////////////////////////////////////////////////// | 269 //////////////////////////////////////////////////////////////////////////////// |
| 270 // LoginDisplayHostImpl, public | 270 // LoginDisplayHostImpl, public |
| 271 | 271 |
| 272 LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& wallpaper_bounds) | 272 LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& wallpaper_bounds) |
| 273 : wallpaper_bounds_(wallpaper_bounds), | 273 : wallpaper_bounds_(wallpaper_bounds), |
| 274 shutting_down_(false), | |
| 275 oobe_progress_bar_visible_(false), | |
| 276 session_starting_(false), | |
| 277 login_window_(NULL), | |
| 278 login_view_(NULL), | |
| 279 webui_login_display_(NULL), | |
| 280 is_showing_login_(false), | |
| 281 is_wallpaper_loaded_(false), | |
| 282 status_area_saved_visibility_(false), | |
| 283 crash_count_(0), | |
| 284 restore_path_(RESTORE_UNKNOWN), | |
| 285 finalize_animation_type_(ANIMATION_WORKSPACE), | |
| 286 startup_sound_played_(false), | |
| 287 startup_sound_honors_spoken_feedback_(false), | |
| 288 is_observing_keyboard_(false), | |
| 289 pointer_factory_(this), | 274 pointer_factory_(this), |
| 290 animation_weak_ptr_factory_(this) { | 275 animation_weak_ptr_factory_(this) { |
| 291 if (chrome::IsRunningInMash()) { | 276 if (chrome::IsRunningInMash()) { |
| 292 // Animation, and initializing hidden, are not currently supported for Mash. | 277 // Animation, and initializing hidden, are not currently supported for Mash. |
| 293 finalize_animation_type_ = ANIMATION_NONE; | 278 finalize_animation_type_ = ANIMATION_NONE; |
| 294 initialize_webui_hidden_ = false; | 279 initialize_webui_hidden_ = false; |
| 295 } | 280 } |
| 296 | 281 |
| 297 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 282 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 298 CrasAudioHandler::Get()->AddAudioObserver(this); | 283 CrasAudioHandler::Get()->AddAudioObserver(this); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 // LoginDisplayHostImpl, LoginDisplayHost: | 441 // LoginDisplayHostImpl, LoginDisplayHost: |
| 457 | 442 |
| 458 LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay( | 443 LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay( |
| 459 LoginDisplay::Delegate* delegate) { | 444 LoginDisplay::Delegate* delegate) { |
| 460 webui_login_display_ = new WebUILoginDisplay(delegate); | 445 webui_login_display_ = new WebUILoginDisplay(delegate); |
| 461 webui_login_display_->set_background_bounds(wallpaper_bounds()); | 446 webui_login_display_->set_background_bounds(wallpaper_bounds()); |
| 462 return webui_login_display_; | 447 return webui_login_display_; |
| 463 } | 448 } |
| 464 | 449 |
| 465 gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const { | 450 gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const { |
| 466 return login_window_ ? login_window_->GetNativeWindow() : NULL; | 451 return login_window_ ? login_window_->GetNativeWindow() : nullptr; |
| 467 } | 452 } |
| 468 | 453 |
| 469 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { | 454 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { |
| 470 return login_view_; | 455 return login_view_; |
| 471 } | 456 } |
| 472 | 457 |
| 473 void LoginDisplayHostImpl::BeforeSessionStart() { | 458 void LoginDisplayHostImpl::BeforeSessionStart() { |
| 474 session_starting_ = true; | 459 session_starting_ = true; |
| 475 } | 460 } |
| 476 | 461 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 | 568 |
| 584 restore_path_ = RESTORE_ADD_USER_INTO_SESSION; | 569 restore_path_ = RESTORE_ADD_USER_INTO_SESSION; |
| 585 completion_callback_ = completion_callback; | 570 completion_callback_ = completion_callback; |
| 586 // Animation is not supported in Mash | 571 // Animation is not supported in Mash |
| 587 if (!chrome::IsRunningInMash()) | 572 if (!chrome::IsRunningInMash()) |
| 588 finalize_animation_type_ = ANIMATION_ADD_USER; | 573 finalize_animation_type_ = ANIMATION_ADD_USER; |
| 589 // Observe the user switch animation and defer the deletion of itself only | 574 // Observe the user switch animation and defer the deletion of itself only |
| 590 // after the animation is finished. | 575 // after the animation is finished. |
| 591 chrome::MultiUserWindowManager* window_manager = | 576 chrome::MultiUserWindowManager* window_manager = |
| 592 chrome::MultiUserWindowManager::GetInstance(); | 577 chrome::MultiUserWindowManager::GetInstance(); |
| 593 // MultiUserWindowManager instance might be null in a unit test. | 578 // MultiUserWindowManager instance might be nullptr in a unit test. |
| 594 if (window_manager) | 579 if (window_manager) |
| 595 window_manager->AddObserver(this); | 580 window_manager->AddObserver(this); |
| 596 | 581 |
| 597 VLOG(1) << "Login WebUI >> user adding"; | 582 VLOG(1) << "Login WebUI >> user adding"; |
| 598 if (!login_window_) | 583 if (!login_window_) |
| 599 LoadURL(GURL(kUserAddingURL)); | 584 LoadURL(GURL(kUserAddingURL)); |
| 600 // We should emit this signal only at login screen (after reboot or sign out). | 585 // We should emit this signal only at login screen (after reboot or sign out). |
| 601 login_view_->set_should_emit_login_prompt_visible(false); | 586 login_view_->set_should_emit_login_prompt_visible(false); |
| 602 | 587 |
| 603 if (!chrome::IsRunningInMash()) { | 588 if (!chrome::IsRunningInMash()) { |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 size.height()); | 983 size.height()); |
| 999 } | 984 } |
| 1000 } | 985 } |
| 1001 | 986 |
| 1002 //////////////////////////////////////////////////////////////////////////////// | 987 //////////////////////////////////////////////////////////////////////////////// |
| 1003 // LoginDisplayHostImpl, views::WidgetRemovalsObserver: | 988 // LoginDisplayHostImpl, views::WidgetRemovalsObserver: |
| 1004 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, | 989 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, |
| 1005 views::View* view) { | 990 views::View* view) { |
| 1006 if (view != static_cast<views::View*>(login_view_)) | 991 if (view != static_cast<views::View*>(login_view_)) |
| 1007 return; | 992 return; |
| 1008 login_view_ = NULL; | 993 login_view_ = nullptr; |
| 1009 widget->RemoveRemovalsObserver(this); | 994 widget->RemoveRemovalsObserver(this); |
| 1010 } | 995 } |
| 1011 | 996 |
| 1012 //////////////////////////////////////////////////////////////////////////////// | 997 //////////////////////////////////////////////////////////////////////////////// |
| 1013 // LoginDisplayHostImpl, chrome::MultiUserWindowManager::Observer: | 998 // LoginDisplayHostImpl, chrome::MultiUserWindowManager::Observer: |
| 1014 void LoginDisplayHostImpl::OnUserSwitchAnimationFinished() { | 999 void LoginDisplayHostImpl::OnUserSwitchAnimationFinished() { |
| 1015 ShutdownDisplayHost(false); | 1000 ShutdownDisplayHost(false); |
| 1016 } | 1001 } |
| 1017 | 1002 |
| 1018 //////////////////////////////////////////////////////////////////////////////// | 1003 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 VLOG(1) << "Login WebUI >> show login wnd on create"; | 1176 VLOG(1) << "Login WebUI >> show login wnd on create"; |
| 1192 login_window_->Show(); | 1177 login_window_->Show(); |
| 1193 } else { | 1178 } else { |
| 1194 VLOG(1) << "Login WebUI >> login wnd is hidden on create"; | 1179 VLOG(1) << "Login WebUI >> login wnd is hidden on create"; |
| 1195 login_view_->set_is_hidden(true); | 1180 login_view_->set_is_hidden(true); |
| 1196 } | 1181 } |
| 1197 login_window_->GetNativeView()->SetName("WebUILoginView"); | 1182 login_window_->GetNativeView()->SetName("WebUILoginView"); |
| 1198 } | 1183 } |
| 1199 | 1184 |
| 1200 void LoginDisplayHostImpl::ResetLoginWindowAndView() { | 1185 void LoginDisplayHostImpl::ResetLoginWindowAndView() { |
| 1201 if (!login_window_) | 1186 // Make sure to reset the |login_view_| pointer first; it is owned by |
| 1202 return; | 1187 // |login_window_|. Closing |login_window_| could immediately invalidate the |
| 1203 login_window_->Close(); | 1188 // |login_view_| pointer. |
| 1204 login_window_ = NULL; | 1189 if (login_view_) { |
| 1190 login_view_->SetUIEnabled(true); |
| 1191 login_view_ = nullptr; |
| 1192 } |
| 1205 | 1193 |
| 1206 if (!login_view_) | 1194 if (login_window_) { |
| 1207 return; | 1195 login_window_->Close(); |
| 1208 login_view_->SetUIEnabled(true); | 1196 login_window_ = nullptr; |
| 1209 login_view_ = NULL; | 1197 } |
| 1210 } | 1198 } |
| 1211 | 1199 |
| 1212 void LoginDisplayHostImpl::OnAuthPrewarmDone() { | 1200 void LoginDisplayHostImpl::OnAuthPrewarmDone() { |
| 1213 auth_prewarmer_.reset(); | 1201 auth_prewarmer_.reset(); |
| 1214 } | 1202 } |
| 1215 | 1203 |
| 1216 void LoginDisplayHostImpl::SetOobeProgressBarVisible(bool visible) { | 1204 void LoginDisplayHostImpl::SetOobeProgressBarVisible(bool visible) { |
| 1217 GetOobeUI()->ShowOobeUI(visible); | 1205 GetOobeUI()->ShowOobeUI(visible); |
| 1218 } | 1206 } |
| 1219 | 1207 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 | 1382 |
| 1395 locale_util::SwitchLanguageCallback callback( | 1383 locale_util::SwitchLanguageCallback callback( |
| 1396 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); | 1384 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); |
| 1397 | 1385 |
| 1398 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1386 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1399 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, | 1387 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, |
| 1400 callback, ProfileManager::GetActiveUserProfile()); | 1388 callback, ProfileManager::GetActiveUserProfile()); |
| 1401 } | 1389 } |
| 1402 | 1390 |
| 1403 } // namespace chromeos | 1391 } // namespace chromeos |
| OLD | NEW |