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

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

Issue 2042913002: Converts MruWindowTracker to work with common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: not equal Created 4 years, 6 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
« no previous file with comments | « no previous file | ash/ash.gyp » ('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/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/common/wm/wm_event.h" 8 #include "ash/common/wm/wm_event.h"
9 #include "ash/common/wm_window.h"
9 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
10 #include "ash/display/display_util.h" 11 #include "ash/display/display_util.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/shell_delegate.h" 13 #include "ash/shell_delegate.h"
13 #include "ash/wm/mru_window_tracker.h" 14 #include "ash/wm/mru_window_tracker.h"
14 #include "ash/wm/window_state_aura.h" 15 #include "ash/wm/window_state_aura.h"
15 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
16 #include "base/metrics/user_metrics.h" 17 #include "base/metrics/user_metrics.h"
17 18
18 namespace ash { 19 namespace ash {
19 namespace accelerators { 20 namespace accelerators {
20 21
21 bool ToggleMinimized() { 22 bool ToggleMinimized() {
22 aura::Window* window = wm::GetActiveWindow(); 23 aura::Window* window = wm::GetActiveWindow();
23 // Attempt to restore the window that would be cycled through next from 24 // Attempt to restore the window that would be cycled through next from
24 // the launcher when there is no active window. 25 // the launcher when there is no active window.
25 if (!window) { 26 if (!window) {
26 MruWindowTracker::WindowList mru_windows( 27 MruWindowTracker::WindowList mru_windows(
27 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList()); 28 Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList());
28 if (!mru_windows.empty()) 29 if (!mru_windows.empty())
29 wm::GetWindowState(mru_windows.front())->Activate(); 30 mru_windows.front()->GetWindowState()->Activate();
30 return true; 31 return true;
31 } 32 }
32 wm::WindowState* window_state = wm::GetWindowState(window); 33 wm::WindowState* window_state = wm::GetWindowState(window);
33 if (!window_state->CanMinimize()) 34 if (!window_state->CanMinimize())
34 return false; 35 return false;
35 window_state->Minimize(); 36 window_state->Minimize();
36 return true; 37 return true;
37 } 38 }
38 39
39 void ToggleMaximized() { 40 void ToggleMaximized() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 std::find_if(modes.begin(), modes.end(), 102 std::find_if(modes.begin(), modes.end(),
102 [](const DisplayMode& mode) { return mode.native; }); 103 [](const DisplayMode& mode) { return mode.native; });
103 display_manager->SetDisplayMode(DisplayManager::kUnifiedDisplayId, *iter); 104 display_manager->SetDisplayMode(DisplayManager::kUnifiedDisplayId, *iter);
104 } else { 105 } else {
105 SetDisplayUIScale(display_manager->GetDisplayIdForUIScaling(), 1.0f); 106 SetDisplayUIScale(display_manager->GetDisplayIdForUIScaling(), 1.0f);
106 } 107 }
107 } 108 }
108 109
109 } // namespace accelerators 110 } // namespace accelerators
110 } // namespace ash 111 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698