Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: ash/accelerators/accelerator_commands.cc

Issue 181563004: Remove --ash-disable-overview-mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/accelerators/accelerator_commands_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/mru_window_tracker.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
11 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
12 #include "ash/wm/wm_event.h" 12 #include "ash/wm/wm_event.h"
13 #include "base/metrics/user_metrics.h" 13 #include "base/metrics/user_metrics.h"
14 14
15 namespace ash { 15 namespace ash {
16 namespace accelerators { 16 namespace accelerators {
17 17
18 bool ToggleMinimized() { 18 bool ToggleMinimized() {
19 aura::Window* window = wm::GetActiveWindow(); 19 aura::Window* window = wm::GetActiveWindow();
20 // Attempt to restore the window that would be cycled through next from 20 // Attempt to restore the window that would be cycled through next from
21 // the launcher when there is no active window. 21 // the launcher when there is no active window.
22 if (!window) { 22 if (!window) {
23 ash::Shell::GetInstance()->window_cycle_controller()-> 23 MruWindowTracker::WindowList mru_windows(
24 HandleCycleWindow(WindowCycleController::FORWARD, false); 24 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList());
25 if (!mru_windows.empty())
26 wm::GetWindowState(mru_windows.front())->Activate();
25 return true; 27 return true;
26 } 28 }
27 wm::WindowState* window_state = wm::GetWindowState(window); 29 wm::WindowState* window_state = wm::GetWindowState(window);
28 if (!window_state->CanMinimize()) 30 if (!window_state->CanMinimize())
29 return false; 31 return false;
30 window_state->Minimize(); 32 window_state->Minimize();
31 return true; 33 return true;
32 } 34 }
33 35
34 void ToggleMaximized() { 36 void ToggleMaximized() {
35 wm::WindowState* window_state = wm::GetActiveWindowState(); 37 wm::WindowState* window_state = wm::GetActiveWindowState();
36 if (!window_state) 38 if (!window_state)
37 return; 39 return;
38 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Maximized")); 40 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Maximized"));
39 wm::WMEvent event(wm::WM_EVENT_TOGGLE_MAXIMIZE); 41 wm::WMEvent event(wm::WM_EVENT_TOGGLE_MAXIMIZE);
40 window_state->OnWMEvent(&event); 42 window_state->OnWMEvent(&event);
41 } 43 }
42 44
43 void ToggleFullscreen() { 45 void ToggleFullscreen() {
44 wm::WindowState* window_state = wm::GetActiveWindowState(); 46 wm::WindowState* window_state = wm::GetActiveWindowState();
45 if (window_state) { 47 if (window_state) {
46 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); 48 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
47 window_state->OnWMEvent(&event); 49 window_state->OnWMEvent(&event);
48 } 50 }
49 } 51 }
50 52
51 } // namespace accelerators 53 } // namespace accelerators
52 } // namespace ash 54 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_commands_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698