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 "ash/accelerators/accelerator_commands.h" | 5 #include "ash/accelerators/accelerator_commands.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/wm/window_cycle_controller.h" | 9 #include "ash/wm/window_cycle_controller.h" |
| 10 #include "ash/wm/window_state.h" |
10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
11 | 12 |
12 namespace ash { | 13 namespace ash { |
13 namespace accelerators { | 14 namespace accelerators { |
14 | 15 |
15 bool ToggleMinimized() { | 16 bool ToggleMinimized() { |
16 aura::Window* window = wm::GetActiveWindow(); | 17 aura::Window* window = wm::GetActiveWindow(); |
17 // Attempt to restore the window that would be cycled through next from | 18 // Attempt to restore the window that would be cycled through next from |
18 // the launcher when there is no active window. | 19 // the launcher when there is no active window. |
19 if (!window) { | 20 if (!window) { |
20 ash::Shell::GetInstance()->window_cycle_controller()-> | 21 ash::Shell::GetInstance()->window_cycle_controller()-> |
21 HandleCycleWindow(WindowCycleController::FORWARD, false); | 22 HandleCycleWindow(WindowCycleController::FORWARD, false); |
22 return true; | 23 return true; |
23 } | 24 } |
| 25 wm::WindowState* window_state = wm::GetWindowState(window); |
24 // Disable the shortcut for minimizing full screen window due to | 26 // Disable the shortcut for minimizing full screen window due to |
25 // crbug.com/131709, which is a crashing issue related to minimizing | 27 // crbug.com/131709, which is a crashing issue related to minimizing |
26 // full screen pepper window. | 28 // full screen pepper window. |
27 if (wm::IsWindowFullscreen(window) || !wm::CanMinimizeWindow(window)) | 29 if (window_state->IsFullscreen() || !window_state->CanMinimize()) |
28 return false; | 30 return false; |
29 ash::Shell::GetInstance()->delegate()->RecordUserMetricsAction( | 31 ash::Shell::GetInstance()->delegate()->RecordUserMetricsAction( |
30 ash::UMA_MINIMIZE_PER_KEY); | 32 ash::UMA_MINIMIZE_PER_KEY); |
31 wm::MinimizeWindow(window); | 33 window_state->Minimize(); |
32 return true; | 34 return true; |
33 } | 35 } |
34 | 36 |
35 } // namespace accelerators | 37 } // namespace accelerators |
36 } // namespace ash | 38 } // namespace ash |
OLD | NEW |