Chromium Code Reviews| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 namespace chromeos { | 259 namespace chromeos { |
| 260 | 260 |
| 261 // static | 261 // static |
| 262 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111; | 262 const int LoginDisplayHostImpl::kShowLoginWebUIid = 0x1111; |
| 263 | 263 |
| 264 //////////////////////////////////////////////////////////////////////////////// | 264 //////////////////////////////////////////////////////////////////////////////// |
| 265 // LoginDisplayHostImpl, public | 265 // LoginDisplayHostImpl, public |
| 266 | 266 |
| 267 LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& wallpaper_bounds) | 267 LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& wallpaper_bounds) |
| 268 : wallpaper_bounds_(wallpaper_bounds), | 268 : wallpaper_bounds_(wallpaper_bounds), |
| 269 shutting_down_(false), | |
| 270 oobe_progress_bar_visible_(false), | |
| 271 session_starting_(false), | |
| 272 login_window_(NULL), | |
| 273 login_view_(NULL), | |
| 274 webui_login_display_(NULL), | |
| 275 is_showing_login_(false), | |
| 276 is_wallpaper_loaded_(false), | |
| 277 status_area_saved_visibility_(false), | |
| 278 crash_count_(0), | |
| 279 restore_path_(RESTORE_UNKNOWN), | |
| 280 finalize_animation_type_(ANIMATION_WORKSPACE), | |
| 281 startup_sound_played_(false), | |
| 282 startup_sound_honors_spoken_feedback_(false), | |
| 283 is_observing_keyboard_(false), | |
| 284 pointer_factory_(this), | 269 pointer_factory_(this), |
| 285 animation_weak_ptr_factory_(this) { | 270 animation_weak_ptr_factory_(this) { |
| 286 if (chrome::IsRunningInMash()) { | 271 if (chrome::IsRunningInMash()) { |
| 287 // Animation, and initializing hidden, are not currently supported for Mash. | 272 // Animation, and initializing hidden, are not currently supported for Mash. |
| 288 finalize_animation_type_ = ANIMATION_NONE; | 273 finalize_animation_type_ = ANIMATION_NONE; |
| 289 initialize_webui_hidden_ = false; | 274 initialize_webui_hidden_ = false; |
| 290 } | 275 } |
| 291 | 276 |
| 292 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 277 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 293 CrasAudioHandler::Get()->AddAudioObserver(this); | 278 CrasAudioHandler::Get()->AddAudioObserver(this); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 // LoginDisplayHostImpl, LoginDisplayHost: | 436 // LoginDisplayHostImpl, LoginDisplayHost: |
| 452 | 437 |
| 453 LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay( | 438 LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay( |
| 454 LoginDisplay::Delegate* delegate) { | 439 LoginDisplay::Delegate* delegate) { |
| 455 webui_login_display_ = new WebUILoginDisplay(delegate); | 440 webui_login_display_ = new WebUILoginDisplay(delegate); |
| 456 webui_login_display_->set_background_bounds(wallpaper_bounds()); | 441 webui_login_display_->set_background_bounds(wallpaper_bounds()); |
| 457 return webui_login_display_; | 442 return webui_login_display_; |
| 458 } | 443 } |
| 459 | 444 |
| 460 gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const { | 445 gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const { |
| 461 return login_window_ ? login_window_->GetNativeWindow() : NULL; | 446 return login_window_ ? login_window_->GetNativeWindow() : nullptr; |
| 462 } | 447 } |
| 463 | 448 |
| 464 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { | 449 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { |
| 465 return login_view_; | 450 return login_view_; |
| 466 } | 451 } |
| 467 | 452 |
| 468 void LoginDisplayHostImpl::BeforeSessionStart() { | 453 void LoginDisplayHostImpl::BeforeSessionStart() { |
| 469 session_starting_ = true; | 454 session_starting_ = true; |
| 470 } | 455 } |
| 471 | 456 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 | 563 |
| 579 restore_path_ = RESTORE_ADD_USER_INTO_SESSION; | 564 restore_path_ = RESTORE_ADD_USER_INTO_SESSION; |
| 580 completion_callback_ = completion_callback; | 565 completion_callback_ = completion_callback; |
| 581 // Animation is not supported in Mash | 566 // Animation is not supported in Mash |
| 582 if (!chrome::IsRunningInMash()) | 567 if (!chrome::IsRunningInMash()) |
| 583 finalize_animation_type_ = ANIMATION_ADD_USER; | 568 finalize_animation_type_ = ANIMATION_ADD_USER; |
| 584 // Observe the user switch animation and defer the deletion of itself only | 569 // Observe the user switch animation and defer the deletion of itself only |
| 585 // after the animation is finished. | 570 // after the animation is finished. |
| 586 chrome::MultiUserWindowManager* window_manager = | 571 chrome::MultiUserWindowManager* window_manager = |
| 587 chrome::MultiUserWindowManager::GetInstance(); | 572 chrome::MultiUserWindowManager::GetInstance(); |
| 588 // MultiUserWindowManager instance might be null in a unit test. | 573 // MultiUserWindowManager instance might be nullptr in a unit test. |
| 589 if (window_manager) | 574 if (window_manager) |
| 590 window_manager->AddObserver(this); | 575 window_manager->AddObserver(this); |
| 591 | 576 |
| 592 VLOG(1) << "Login WebUI >> user adding"; | 577 VLOG(1) << "Login WebUI >> user adding"; |
| 593 if (!login_window_) | 578 if (!login_window_) |
| 594 LoadURL(GURL(kUserAddingURL)); | 579 LoadURL(GURL(kUserAddingURL)); |
| 595 // We should emit this signal only at login screen (after reboot or sign out). | 580 // We should emit this signal only at login screen (after reboot or sign out). |
| 596 login_view_->set_should_emit_login_prompt_visible(false); | 581 login_view_->set_should_emit_login_prompt_visible(false); |
| 597 | 582 |
| 598 if (!chrome::IsRunningInMash()) { | 583 if (!chrome::IsRunningInMash()) { |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 973 size.height()); | 958 size.height()); |
| 974 } | 959 } |
| 975 } | 960 } |
| 976 | 961 |
| 977 //////////////////////////////////////////////////////////////////////////////// | 962 //////////////////////////////////////////////////////////////////////////////// |
| 978 // LoginDisplayHostImpl, views::WidgetRemovalsObserver: | 963 // LoginDisplayHostImpl, views::WidgetRemovalsObserver: |
| 979 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, | 964 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, |
| 980 views::View* view) { | 965 views::View* view) { |
| 981 if (view != static_cast<views::View*>(login_view_)) | 966 if (view != static_cast<views::View*>(login_view_)) |
| 982 return; | 967 return; |
| 983 login_view_ = NULL; | 968 login_view_ = nullptr; |
| 984 widget->RemoveRemovalsObserver(this); | 969 widget->RemoveRemovalsObserver(this); |
| 985 } | 970 } |
| 986 | 971 |
| 987 //////////////////////////////////////////////////////////////////////////////// | 972 //////////////////////////////////////////////////////////////////////////////// |
| 988 // LoginDisplayHostImpl, chrome::MultiUserWindowManager::Observer: | 973 // LoginDisplayHostImpl, chrome::MultiUserWindowManager::Observer: |
| 989 void LoginDisplayHostImpl::OnUserSwitchAnimationFinished() { | 974 void LoginDisplayHostImpl::OnUserSwitchAnimationFinished() { |
| 990 ShutdownDisplayHost(false); | 975 ShutdownDisplayHost(false); |
| 991 } | 976 } |
| 992 | 977 |
| 993 //////////////////////////////////////////////////////////////////////////////// | 978 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1166 VLOG(1) << "Login WebUI >> show login wnd on create"; | 1151 VLOG(1) << "Login WebUI >> show login wnd on create"; |
| 1167 login_window_->Show(); | 1152 login_window_->Show(); |
| 1168 } else { | 1153 } else { |
| 1169 VLOG(1) << "Login WebUI >> login wnd is hidden on create"; | 1154 VLOG(1) << "Login WebUI >> login wnd is hidden on create"; |
| 1170 login_view_->set_is_hidden(true); | 1155 login_view_->set_is_hidden(true); |
| 1171 } | 1156 } |
| 1172 login_window_->GetNativeView()->SetName("WebUILoginView"); | 1157 login_window_->GetNativeView()->SetName("WebUILoginView"); |
| 1173 } | 1158 } |
| 1174 | 1159 |
| 1175 void LoginDisplayHostImpl::ResetLoginWindowAndView() { | 1160 void LoginDisplayHostImpl::ResetLoginWindowAndView() { |
| 1161 if (!login_view_) | |
|
achuithb
2017/02/06 22:38:58
Please add a comment explaining why this order is
jdufault
2017/02/06 22:52:10
Done.
| |
| 1162 return; | |
| 1163 login_view_->SetUIEnabled(true); | |
| 1164 login_view_ = nullptr; | |
| 1165 | |
| 1176 if (!login_window_) | 1166 if (!login_window_) |
| 1177 return; | 1167 return; |
| 1178 login_window_->Close(); | 1168 login_window_->Close(); |
| 1179 login_window_ = NULL; | 1169 login_window_ = nullptr; |
| 1180 | |
| 1181 if (!login_view_) | |
| 1182 return; | |
| 1183 login_view_->SetUIEnabled(true); | |
| 1184 login_view_ = NULL; | |
| 1185 } | 1170 } |
| 1186 | 1171 |
| 1187 void LoginDisplayHostImpl::OnAuthPrewarmDone() { | 1172 void LoginDisplayHostImpl::OnAuthPrewarmDone() { |
| 1188 auth_prewarmer_.reset(); | 1173 auth_prewarmer_.reset(); |
| 1189 } | 1174 } |
| 1190 | 1175 |
| 1191 void LoginDisplayHostImpl::SetOobeProgressBarVisible(bool visible) { | 1176 void LoginDisplayHostImpl::SetOobeProgressBarVisible(bool visible) { |
| 1192 GetOobeUI()->ShowOobeUI(visible); | 1177 GetOobeUI()->ShowOobeUI(visible); |
| 1193 } | 1178 } |
| 1194 | 1179 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 | 1354 |
| 1370 locale_util::SwitchLanguageCallback callback( | 1355 locale_util::SwitchLanguageCallback callback( |
| 1371 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); | 1356 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); |
| 1372 | 1357 |
| 1373 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1358 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1374 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, | 1359 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, |
| 1375 callback, ProfileManager::GetActiveUserProfile()); | 1360 callback, ProfileManager::GetActiveUserProfile()); |
| 1376 } | 1361 } |
| 1377 | 1362 |
| 1378 } // namespace chromeos | 1363 } // namespace chromeos |
| OLD | NEW |