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/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
11 #include "ash/common/wallpaper/wallpaper_delegate.h" | 11 #include "ash/common/wallpaper/wallpaper_delegate.h" |
12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
13 #include "ash/desktop_background/desktop_background_controller.h" | |
14 #include "ash/public/interfaces/container.mojom.h" | 13 #include "ash/public/interfaces/container.mojom.h" |
15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/wallpaper/wallpaper_controller.h" |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/location.h" | 18 #include "base/location.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/macros.h" | 20 #include "base/macros.h" |
21 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
22 #include "base/strings/string_split.h" | 22 #include "base/strings/string_split.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
25 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } // namespace | 257 } // namespace |
258 | 258 |
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& background_bounds) | 267 LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& wallpaper_bounds) |
268 : background_bounds_(background_bounds), | 268 : wallpaper_bounds_(wallpaper_bounds), |
269 shutting_down_(false), | 269 shutting_down_(false), |
270 oobe_progress_bar_visible_(false), | 270 oobe_progress_bar_visible_(false), |
271 session_starting_(false), | 271 session_starting_(false), |
272 login_window_(NULL), | 272 login_window_(NULL), |
273 login_view_(NULL), | 273 login_view_(NULL), |
274 webui_login_display_(NULL), | 274 webui_login_display_(NULL), |
275 is_showing_login_(false), | 275 is_showing_login_(false), |
276 is_wallpaper_loaded_(false), | 276 is_wallpaper_loaded_(false), |
277 status_area_saved_visibility_(false), | 277 status_area_saved_visibility_(false), |
278 crash_count_(0), | 278 crash_count_(0), |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode(); | 446 ProfileManager::GetActiveUserProfile()))->EnableOfflineMode(); |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 //////////////////////////////////////////////////////////////////////////////// | 450 //////////////////////////////////////////////////////////////////////////////// |
451 // LoginDisplayHostImpl, LoginDisplayHost: | 451 // LoginDisplayHostImpl, LoginDisplayHost: |
452 | 452 |
453 LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay( | 453 LoginDisplay* LoginDisplayHostImpl::CreateLoginDisplay( |
454 LoginDisplay::Delegate* delegate) { | 454 LoginDisplay::Delegate* delegate) { |
455 webui_login_display_ = new WebUILoginDisplay(delegate); | 455 webui_login_display_ = new WebUILoginDisplay(delegate); |
456 webui_login_display_->set_background_bounds(background_bounds()); | 456 webui_login_display_->set_background_bounds(wallpaper_bounds()); |
457 return webui_login_display_; | 457 return webui_login_display_; |
458 } | 458 } |
459 | 459 |
460 gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const { | 460 gfx::NativeWindow LoginDisplayHostImpl::GetNativeWindow() const { |
461 return login_window_ ? login_window_->GetNativeWindow() : NULL; | 461 return login_window_ ? login_window_->GetNativeWindow() : NULL; |
462 } | 462 } |
463 | 463 |
464 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { | 464 WebUILoginView* LoginDisplayHostImpl::GetWebUILoginView() const { |
465 return login_view_; | 465 return login_view_; |
466 } | 466 } |
467 | 467 |
468 void LoginDisplayHostImpl::BeforeSessionStart() { | 468 void LoginDisplayHostImpl::BeforeSessionStart() { |
469 session_starting_ = true; | 469 session_starting_ = true; |
470 } | 470 } |
471 | 471 |
472 void LoginDisplayHostImpl::Finalize() { | 472 void LoginDisplayHostImpl::Finalize() { |
473 DVLOG(1) << "Session starting"; | 473 DVLOG(1) << "Session starting"; |
474 // When adding another user into the session, we defer the background | 474 // When adding another user into the session, we defer the wallpaper's |
475 // wallpaper's animation in order to prevent the flashing of the previous | 475 // animation in order to prevent the flashing of the previous user's windows. |
476 // user's windows. See crbug.com/541864. | 476 // See crbug.com/541864. |
477 if (ash::Shell::HasInstance() && | 477 if (ash::Shell::HasInstance() && |
478 finalize_animation_type_ != ANIMATION_ADD_USER) { | 478 finalize_animation_type_ != ANIMATION_ADD_USER) { |
479 ash::Shell::GetInstance() | 479 ash::Shell::GetInstance() |
480 ->desktop_background_controller() | 480 ->wallpaper_controller() |
481 ->MoveDesktopToUnlockedContainer(); | 481 ->MoveToUnlockedContainer(); |
482 } | 482 } |
483 if (wizard_controller_.get()) | 483 if (wizard_controller_.get()) |
484 wizard_controller_->OnSessionStart(); | 484 wizard_controller_->OnSessionStart(); |
485 | 485 |
486 switch (finalize_animation_type_) { | 486 switch (finalize_animation_type_) { |
487 case ANIMATION_NONE: | 487 case ANIMATION_NONE: |
488 ShutdownDisplayHost(false); | 488 ShutdownDisplayHost(false); |
489 break; | 489 break; |
490 case ANIMATION_WORKSPACE: | 490 case ANIMATION_WORKSPACE: |
491 if (ash::Shell::HasInstance()) | 491 if (ash::Shell::HasInstance()) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // We should emit this signal only at login screen (after reboot or sign out). | 596 // We should emit this signal only at login screen (after reboot or sign out). |
597 login_view_->set_should_emit_login_prompt_visible(false); | 597 login_view_->set_should_emit_login_prompt_visible(false); |
598 | 598 |
599 if (!chrome::IsRunningInMash()) { | 599 if (!chrome::IsRunningInMash()) { |
600 // Lock container can be transparent after lock screen animation. | 600 // Lock container can be transparent after lock screen animation. |
601 aura::Window* lock_container = ash::Shell::GetContainer( | 601 aura::Window* lock_container = ash::Shell::GetContainer( |
602 ash::Shell::GetPrimaryRootWindow(), | 602 ash::Shell::GetPrimaryRootWindow(), |
603 ash::kShellWindowId_LockScreenContainersContainer); | 603 ash::kShellWindowId_LockScreenContainersContainer); |
604 lock_container->layer()->SetOpacity(1.0); | 604 lock_container->layer()->SetOpacity(1.0); |
605 | 605 |
606 ash::Shell::GetInstance() | 606 ash::Shell::GetInstance()->wallpaper_controller()->MoveToLockedContainer(); |
607 ->desktop_background_controller() | |
608 ->MoveDesktopToLockedContainer(); | |
609 } else { | 607 } else { |
610 NOTIMPLEMENTED(); | 608 NOTIMPLEMENTED(); |
611 } | 609 } |
612 | 610 |
613 existing_user_controller_.reset(); // Only one controller in a time. | 611 existing_user_controller_.reset(); // Only one controller in a time. |
614 existing_user_controller_.reset(new chromeos::ExistingUserController(this)); | 612 existing_user_controller_.reset(new chromeos::ExistingUserController(this)); |
615 | 613 |
616 if (!signin_screen_controller_.get()) { | 614 if (!signin_screen_controller_.get()) { |
617 signin_screen_controller_.reset(new SignInScreenController( | 615 signin_screen_controller_.reset(new SignInScreenController( |
618 GetOobeUI(), webui_login_display_->delegate())); | 616 GetOobeUI(), webui_login_display_->delegate())); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 OnBrowserCreated(); | 837 OnBrowserCreated(); |
840 registrar_.Remove(this, | 838 registrar_.Remove(this, |
841 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 839 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
842 content::NotificationService::AllSources()); | 840 content::NotificationService::AllSources()); |
843 registrar_.Remove(this, | 841 registrar_.Remove(this, |
844 chrome::NOTIFICATION_BROWSER_OPENED, | 842 chrome::NOTIFICATION_BROWSER_OPENED, |
845 content::NotificationService::AllSources()); | 843 content::NotificationService::AllSources()); |
846 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED && | 844 } else if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED && |
847 user_manager::UserManager::Get()->IsCurrentUserNew()) { | 845 user_manager::UserManager::Get()->IsCurrentUserNew()) { |
848 if (!chrome::IsRunningInMash()) { | 846 if (!chrome::IsRunningInMash()) { |
849 // For new user, move desktop to locker container so that windows created | 847 // For new user, move wallpaper to lock container so that windows created |
850 // during the user image picker step are below it. | 848 // during the user image picker step are below it. |
851 ash::Shell::GetInstance() | 849 ash::Shell::GetInstance() |
852 ->desktop_background_controller() | 850 ->wallpaper_controller() |
853 ->MoveDesktopToLockedContainer(); | 851 ->MoveToLockedContainer(); |
854 } else { | 852 } else { |
855 NOTIMPLEMENTED(); | 853 NOTIMPLEMENTED(); |
856 } | 854 } |
857 registrar_.Remove(this, | 855 registrar_.Remove(this, |
858 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 856 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
859 content::NotificationService::AllSources()); | 857 content::NotificationService::AllSources()); |
860 } else if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { | 858 } else if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { |
861 VLOG(1) << "Login WebUI >> wp animation done"; | 859 VLOG(1) << "Login WebUI >> wp animation done"; |
862 is_wallpaper_loaded_ = true; | 860 is_wallpaper_loaded_ = true; |
863 if (!chrome::IsRunningInMash()) { | 861 if (!chrome::IsRunningInMash()) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 base::MessageLoop::current()->QuitWhenIdle(); | 1005 base::MessageLoop::current()->QuitWhenIdle(); |
1008 | 1006 |
1009 if (!completion_callback_.is_null()) | 1007 if (!completion_callback_.is_null()) |
1010 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 1008 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
1011 completion_callback_); | 1009 completion_callback_); |
1012 | 1010 |
1013 if (ash::Shell::HasInstance() && | 1011 if (ash::Shell::HasInstance() && |
1014 finalize_animation_type_ == ANIMATION_ADD_USER) { | 1012 finalize_animation_type_ == ANIMATION_ADD_USER) { |
1015 if (!chrome::IsRunningInMash()) { | 1013 if (!chrome::IsRunningInMash()) { |
1016 ash::Shell::GetInstance() | 1014 ash::Shell::GetInstance() |
1017 ->desktop_background_controller() | 1015 ->wallpaper_controller() |
1018 ->MoveDesktopToUnlockedContainer(); | 1016 ->MoveToUnlockedContainer(); |
1019 } else { | 1017 } else { |
1020 NOTIMPLEMENTED(); | 1018 NOTIMPLEMENTED(); |
1021 } | 1019 } |
1022 } | 1020 } |
1023 } | 1021 } |
1024 | 1022 |
1025 void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() { | 1023 void LoginDisplayHostImpl::ScheduleWorkspaceAnimation() { |
1026 if (chrome::IsRunningInMash()) { | 1024 if (chrome::IsRunningInMash()) { |
1027 NOTIMPLEMENTED(); | 1025 NOTIMPLEMENTED(); |
1028 return; | 1026 return; |
1029 } | 1027 } |
1030 if (ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | 1028 if (ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), |
1031 ash::kShellWindowId_DesktopBackgroundContainer) | 1029 ash::kShellWindowId_WallpaperContainer) |
1032 ->children() | 1030 ->children() |
1033 .empty()) { | 1031 .empty()) { |
1034 // If there is no background window, don't perform any animation on the | 1032 // If there is no wallpaper window, don't perform any animation on the |
1035 // default and background layer because there is nothing behind it. | 1033 // default and wallpaper layer because there is nothing behind it. |
1036 return; | 1034 return; |
1037 } | 1035 } |
1038 | 1036 |
1039 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1037 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1040 switches::kDisableLoginAnimations)) | 1038 switches::kDisableLoginAnimations)) |
1041 ash::Shell::GetInstance()->DoInitialWorkspaceAnimation(); | 1039 ash::Shell::GetInstance()->DoInitialWorkspaceAnimation(); |
1042 } | 1040 } |
1043 | 1041 |
1044 void LoginDisplayHostImpl::ScheduleFadeOutAnimation(int animation_speed_ms) { | 1042 void LoginDisplayHostImpl::ScheduleFadeOutAnimation(int animation_speed_ms) { |
1045 // login window might have been closed by OnBrowserCreated() at this moment. | 1043 // login window might have been closed by OnBrowserCreated() at this moment. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 views::FocusManager::set_arrow_key_traversal_enabled(true); | 1120 views::FocusManager::set_arrow_key_traversal_enabled(true); |
1123 // crbug.com/405859 | 1121 // crbug.com/405859 |
1124 focus_ring_controller_.reset(new FocusRingController); | 1122 focus_ring_controller_.reset(new FocusRingController); |
1125 focus_ring_controller_->SetVisible(true); | 1123 focus_ring_controller_->SetVisible(true); |
1126 | 1124 |
1127 keyboard_driven_oobe_key_handler_.reset(new KeyboardDrivenOobeKeyHandler); | 1125 keyboard_driven_oobe_key_handler_.reset(new KeyboardDrivenOobeKeyHandler); |
1128 } | 1126 } |
1129 | 1127 |
1130 views::Widget::InitParams params( | 1128 views::Widget::InitParams params( |
1131 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 1129 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
1132 params.bounds = background_bounds(); | 1130 params.bounds = wallpaper_bounds(); |
1133 params.show_state = ui::SHOW_STATE_FULLSCREEN; | 1131 params.show_state = ui::SHOW_STATE_FULLSCREEN; |
1134 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 1132 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
1135 // The ash::Shell containers are not available in Mash | 1133 // The ash::Shell containers are not available in Mash |
1136 if (!chrome::IsRunningInMash()) { | 1134 if (!chrome::IsRunningInMash()) { |
1137 params.parent = | 1135 params.parent = |
1138 ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), | 1136 ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), |
1139 ash::kShellWindowId_LockScreenContainer); | 1137 ash::kShellWindowId_LockScreenContainer); |
1140 } else { | 1138 } else { |
1141 params.mus_properties[ash::mojom::kWindowContainer_Property] = | 1139 params.mus_properties[ash::mojom::kWindowContainer_Property] = |
1142 mojo::ConvertTo<std::vector<uint8_t>>( | 1140 mojo::ConvertTo<std::vector<uint8_t>>( |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 | 1370 |
1373 locale_util::SwitchLanguageCallback callback( | 1371 locale_util::SwitchLanguageCallback callback( |
1374 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); | 1372 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); |
1375 | 1373 |
1376 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1374 // Load locale keyboards here. Hardware layout would be automatically enabled. |
1377 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, | 1375 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, |
1378 callback, ProfileManager::GetActiveUserProfile()); | 1376 callback, ProfileManager::GetActiveUserProfile()); |
1379 } | 1377 } |
1380 | 1378 |
1381 } // namespace chromeos | 1379 } // namespace chromeos |
OLD | NEW |