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_aura.h" |
6 | 6 |
7 #include "ash/common/wm/mru_window_tracker.h" | 7 #include "ash/common/wm/mru_window_tracker.h" |
James Cook
2016/07/20 16:08:04
not needed (and several below)
sky
2016/07/20 16:42:49
Done.
| |
8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
9 #include "ash/common/wm/wm_event.h" | 9 #include "ash/common/wm/wm_event.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
11 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
12 #include "ash/display/display_manager.h" | 12 #include "ash/display/display_manager.h" |
13 #include "ash/display/display_util.h" | 13 #include "ash/display/display_util.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/wm/screen_pinning_controller.h" | 15 #include "ash/wm/screen_pinning_controller.h" |
16 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
17 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
18 #include "base/metrics/user_metrics.h" | 18 #include "base/metrics/user_metrics.h" |
19 | 19 |
20 namespace ash { | 20 namespace ash { |
21 namespace accelerators { | 21 namespace accelerators { |
22 | 22 |
23 bool ToggleMinimized() { | |
24 aura::Window* window = wm::GetActiveWindow(); | |
25 // Attempt to restore the window that would be cycled through next from | |
26 // the launcher when there is no active window. | |
27 if (!window) { | |
28 MruWindowTracker::WindowList mru_windows( | |
29 WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); | |
30 if (!mru_windows.empty()) | |
31 mru_windows.front()->GetWindowState()->Activate(); | |
32 return true; | |
33 } | |
34 wm::WindowState* window_state = wm::GetWindowState(window); | |
35 if (!window_state->CanMinimize()) | |
36 return false; | |
37 window_state->Minimize(); | |
38 return true; | |
39 } | |
40 | |
41 void ToggleMaximized() { | |
42 wm::WindowState* window_state = wm::GetActiveWindowState(); | |
43 if (!window_state) | |
44 return; | |
45 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Maximized")); | |
46 wm::WMEvent event(wm::WM_EVENT_TOGGLE_MAXIMIZE); | |
47 window_state->OnWMEvent(&event); | |
48 } | |
49 | |
50 void ToggleFullscreen() { | |
51 wm::WindowState* window_state = wm::GetActiveWindowState(); | |
52 if (window_state) { | |
53 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); | |
54 window_state->OnWMEvent(&event); | |
55 } | |
56 } | |
57 | |
58 void ToggleTouchHudProjection() { | 23 void ToggleTouchHudProjection() { |
59 base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear")); | 24 base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear")); |
60 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); | 25 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); |
61 Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); | 26 Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); |
62 } | 27 } |
63 | 28 |
64 bool IsInternalDisplayZoomEnabled() { | 29 bool IsInternalDisplayZoomEnabled() { |
65 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 30 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
66 return display_manager->IsDisplayUIScalingEnabled() || | 31 return display_manager->IsDisplayUIScalingEnabled() || |
67 display_manager->IsInUnifiedMode(); | 32 display_manager->IsInUnifiedMode(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 | 75 |
111 void Unpin() { | 76 void Unpin() { |
112 WmWindow* pinned_window = | 77 WmWindow* pinned_window = |
113 Shell::GetInstance()->screen_pinning_controller()->pinned_window(); | 78 Shell::GetInstance()->screen_pinning_controller()->pinned_window(); |
114 if (pinned_window) | 79 if (pinned_window) |
115 pinned_window->GetWindowState()->Restore(); | 80 pinned_window->GetWindowState()->Restore(); |
116 } | 81 } |
117 | 82 |
118 } // namespace accelerators | 83 } // namespace accelerators |
119 } // namespace ash | 84 } // namespace ash |
OLD | NEW |