| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/ash/multi_user/multi_user_window_manager_chromeos.h" | 5 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" |
| 6 | 6 |
| 7 #include "ash/common/media_controller.h" | 7 #include "ash/common/media_controller.h" |
| 8 #include "ash/common/multi_profile_uma.h" | 8 #include "ash/common/multi_profile_uma.h" |
| 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // Here to avoid a very nasty race condition, we must destruct any previously | 389 // Here to avoid a very nasty race condition, we must destruct any previously |
| 390 // created animation before creating a new one. Otherwise, the newly | 390 // created animation before creating a new one. Otherwise, the newly |
| 391 // constructed will hide all windows of the old user in the first step of the | 391 // constructed will hide all windows of the old user in the first step of the |
| 392 // animation only to be reshown again by the destructor of the old animation. | 392 // animation only to be reshown again by the destructor of the old animation. |
| 393 animation_.reset(); | 393 animation_.reset(); |
| 394 animation_.reset(new UserSwitchAnimatorChromeOS( | 394 animation_.reset(new UserSwitchAnimatorChromeOS( |
| 395 this, current_account_id_, | 395 this, current_account_id_, |
| 396 GetAdjustedAnimationTimeInMS(kUserFadeTimeMS))); | 396 GetAdjustedAnimationTimeInMS(kUserFadeTimeMS))); |
| 397 // Call notifier here instead of observing ActiveUserChanged because | 397 // Call notifier here instead of observing ActiveUserChanged because |
| 398 // this must happen after MultiUserWindowManagerChromeOS is notified. | 398 // this must happen after MultiUserWindowManagerChromeOS is notified. |
| 399 ash::WmShell::Get()->media_controller()->RequestCaptureState(); | 399 ash::Shell::Get()->media_controller()->RequestCaptureState(); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void MultiUserWindowManagerChromeOS::OnWindowDestroyed(aura::Window* window) { | 402 void MultiUserWindowManagerChromeOS::OnWindowDestroyed(aura::Window* window) { |
| 403 if (GetWindowOwner(window).empty()) { | 403 if (GetWindowOwner(window).empty()) { |
| 404 // This must be a window in the transient chain - remove it and its | 404 // This must be a window in the transient chain - remove it and its |
| 405 // children from the owner. | 405 // children from the owner. |
| 406 RemoveTransientOwnerRecursive(window); | 406 RemoveTransientOwnerRecursive(window); |
| 407 return; | 407 return; |
| 408 } | 408 } |
| 409 wm::TransientWindowManager::Get(window)->RemoveObserver(this); | 409 wm::TransientWindowManager::Get(window)->RemoveObserver(this); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 | 685 |
| 686 void MultiUserWindowManagerChromeOS::SetWindowVisible( | 686 void MultiUserWindowManagerChromeOS::SetWindowVisible( |
| 687 aura::Window* window, | 687 aura::Window* window, |
| 688 bool visible, | 688 bool visible, |
| 689 int animation_time_in_ms) { | 689 int animation_time_in_ms) { |
| 690 // The MaximizeModeWindowManager will not handle invisible windows since they | 690 // The MaximizeModeWindowManager will not handle invisible windows since they |
| 691 // are not user activatable. Since invisible windows are not being tracked, | 691 // are not user activatable. Since invisible windows are not being tracked, |
| 692 // we tell it to maximize / track this window now before it gets shown, to | 692 // we tell it to maximize / track this window now before it gets shown, to |
| 693 // reduce animation jank from multiple resizes. | 693 // reduce animation jank from multiple resizes. |
| 694 if (visible) { | 694 if (visible) { |
| 695 ash::WmShell::Get()->maximize_mode_controller()->AddWindow( | 695 ash::Shell::Get()->maximize_mode_controller()->AddWindow( |
| 696 ash::WmWindow::Get(window)); | 696 ash::WmWindow::Get(window)); |
| 697 } | 697 } |
| 698 | 698 |
| 699 AnimationSetter animation_setter( | 699 AnimationSetter animation_setter( |
| 700 window, | 700 window, |
| 701 GetAdjustedAnimationTimeInMS(animation_time_in_ms)); | 701 GetAdjustedAnimationTimeInMS(animation_time_in_ms)); |
| 702 | 702 |
| 703 if (visible) | 703 if (visible) |
| 704 window->Show(); | 704 window->Show(); |
| 705 else | 705 else |
| 706 window->Hide(); | 706 window->Hide(); |
| 707 } | 707 } |
| 708 | 708 |
| 709 int MultiUserWindowManagerChromeOS::GetAdjustedAnimationTimeInMS( | 709 int MultiUserWindowManagerChromeOS::GetAdjustedAnimationTimeInMS( |
| 710 int default_time_in_ms) const { | 710 int default_time_in_ms) const { |
| 711 return animation_speed_ == ANIMATION_SPEED_NORMAL ? default_time_in_ms : | 711 return animation_speed_ == ANIMATION_SPEED_NORMAL ? default_time_in_ms : |
| 712 (animation_speed_ == ANIMATION_SPEED_FAST ? 10 : 0); | 712 (animation_speed_ == ANIMATION_SPEED_FAST ? 10 : 0); |
| 713 } | 713 } |
| 714 | 714 |
| 715 } // namespace chrome | 715 } // namespace chrome |
| OLD | NEW |