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 "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/multi_profile_uma.h" | 10 #include "ash/multi_profile_uma.h" |
11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
12 #include "ash/session/session_state_delegate.h" | 12 #include "ash/session/session_state_delegate.h" |
13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/shell_delegate.h" | 15 #include "ash/shell_delegate.h" |
16 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
17 #include "ash/system/tray/system_tray_notifier.h" | 17 #include "ash/system/tray/system_tray_notifier.h" |
| 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
18 #include "ash/wm/window_state.h" | 19 #include "ash/wm/window_state.h" |
19 #include "base/auto_reset.h" | 20 #include "base/auto_reset.h" |
20 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/chromeos/login/users/user_manager.h" | 25 #include "chrome/browser/chromeos/login/users/user_manager.h" |
25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chrom
eos.h" | 28 #include "chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chrom
eos.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // dependents have been shown previously already. | 686 // dependents have been shown previously already. |
686 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true); | 687 base::AutoReset<bool> suppressor(&suppress_visibility_changes_, true); |
687 window->Show(); | 688 window->Show(); |
688 } | 689 } |
689 } | 690 } |
690 | 691 |
691 void MultiUserWindowManagerChromeOS::SetWindowVisible( | 692 void MultiUserWindowManagerChromeOS::SetWindowVisible( |
692 aura::Window* window, | 693 aura::Window* window, |
693 bool visible, | 694 bool visible, |
694 int animation_time_in_ms) { | 695 int animation_time_in_ms) { |
| 696 // The MaximizeModeWindowManager will not handle invisible windows since they |
| 697 // are not user activatable. Since invisible windows are not being tracked, |
| 698 // we tell it to maximize / track this window now before it gets shown, to |
| 699 // reduce animation jank from multiple resizes. |
| 700 if (visible) |
| 701 ash::Shell::GetInstance()->maximize_mode_controller()->AddWindow(window); |
| 702 |
695 AnimationSetter animation_setter( | 703 AnimationSetter animation_setter( |
696 window, | 704 window, |
697 GetAdjustedAnimationTimeInMS(animation_time_in_ms)); | 705 GetAdjustedAnimationTimeInMS(animation_time_in_ms)); |
698 | 706 |
699 if (visible) | 707 if (visible) |
700 window->Show(); | 708 window->Show(); |
701 else | 709 else |
702 window->Hide(); | 710 window->Hide(); |
703 | 711 |
704 // Make sure that animations have no influence on the window state after the | 712 // Make sure that animations have no influence on the window state after the |
705 // call. | 713 // call. |
706 DCHECK_EQ(visible, window->IsVisible()); | 714 DCHECK_EQ(visible, window->IsVisible()); |
707 } | 715 } |
708 | 716 |
709 int MultiUserWindowManagerChromeOS::GetAdjustedAnimationTimeInMS( | 717 int MultiUserWindowManagerChromeOS::GetAdjustedAnimationTimeInMS( |
710 int default_time_in_ms) const { | 718 int default_time_in_ms) const { |
711 return animation_speed_ == ANIMATION_SPEED_NORMAL ? default_time_in_ms : | 719 return animation_speed_ == ANIMATION_SPEED_NORMAL ? default_time_in_ms : |
712 (animation_speed_ == ANIMATION_SPEED_FAST ? 10 : 0); | 720 (animation_speed_ == ANIMATION_SPEED_FAST ? 10 : 0); |
713 } | 721 } |
714 | 722 |
715 } // namespace chrome | 723 } // namespace chrome |
OLD | NEW |