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

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

Issue 2895713002: [mus+ash] Removes WmWindow from ash/wm/mru_window_tracker and overview mode (Closed)
Patch Set: Address nits, unit_tests target compiles Created 3 years, 7 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
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/wm/mru_window_tracker.h" 8 #include "ash/wm/mru_window_tracker.h"
9 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
11 #include "ash/wm/wm_event.h" 11 #include "ash/wm/wm_event.h"
12 #include "ash/wm_window.h"
13 #include "base/metrics/user_metrics.h" 12 #include "base/metrics/user_metrics.h"
14 13
15 namespace ash { 14 namespace ash {
16 namespace accelerators { 15 namespace accelerators {
17 16
18 bool ToggleMinimized() { 17 bool ToggleMinimized() {
19 WmWindow* window = WmWindow::Get(wm::GetActiveWindow()); 18 aura::Window* window = wm::GetActiveWindow();
20 // Attempt to restore the window that would be cycled through next from 19 // Attempt to restore the window that would be cycled through next from
21 // the launcher when there is no active window. 20 // the launcher when there is no active window.
22 if (!window) { 21 if (!window) {
23 MruWindowTracker::WindowList mru_windows( 22 MruWindowTracker::WindowList mru_windows(
24 Shell::Get()->mru_window_tracker()->BuildMruWindowList()); 23 Shell::Get()->mru_window_tracker()->BuildMruWindowList());
25 if (!mru_windows.empty()) 24 if (!mru_windows.empty())
26 mru_windows.front()->GetWindowState()->Activate(); 25 wm::GetWindowState(mru_windows.front())->Activate();
27 return true; 26 return true;
28 } 27 }
29 wm::WindowState* window_state = window->GetWindowState(); 28 wm::WindowState* window_state = wm::GetWindowState(window);
30 if (!window_state->CanMinimize()) 29 if (!window_state->CanMinimize())
31 return false; 30 return false;
32 window_state->Minimize(); 31 window_state->Minimize();
33 return true; 32 return true;
34 } 33 }
35 34
36 void ToggleMaximized() { 35 void ToggleMaximized() {
37 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow()); 36 aura::Window* active_window = wm::GetActiveWindow();
38 if (!active_window) 37 if (!active_window)
39 return; 38 return;
40 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Maximized")); 39 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Maximized"));
41 wm::WMEvent event(wm::WM_EVENT_TOGGLE_MAXIMIZE); 40 wm::WMEvent event(wm::WM_EVENT_TOGGLE_MAXIMIZE);
42 active_window->GetWindowState()->OnWMEvent(&event); 41 wm::GetWindowState(active_window)->OnWMEvent(&event);
43 } 42 }
44 43
45 void ToggleFullscreen() { 44 void ToggleFullscreen() {
46 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow()); 45 aura::Window* active_window = wm::GetActiveWindow();
47 if (!active_window) 46 if (!active_window)
48 return; 47 return;
49 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); 48 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
50 active_window->GetWindowState()->OnWMEvent(&event); 49 wm::GetWindowState(active_window)->OnWMEvent(&event);
51 } 50 }
52 51
53 } // namespace accelerators 52 } // namespace accelerators
54 } // namespace ash 53 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698