| Index: ash/accelerators/accelerator_commands.cc
|
| diff --git a/ash/accelerators/accelerator_commands.cc b/ash/accelerators/accelerator_commands.cc
|
| index b804d9150aaae5ab68b889a8193b9e7007ca8686..3c649550bb6e07ad1d8c57847badb2adaa236ae4 100644
|
| --- a/ash/accelerators/accelerator_commands.cc
|
| +++ b/ash/accelerators/accelerator_commands.cc
|
| @@ -21,7 +21,7 @@ namespace ash {
|
| namespace accelerators {
|
|
|
| bool ToggleMinimized() {
|
| - aura::Window* window = wm::GetActiveWindow();
|
| + WmWindow* window = WmShell::Get()->GetActiveWindow();
|
| // Attempt to restore the window that would be cycled through next from
|
| // the launcher when there is no active window.
|
| if (!window) {
|
| @@ -31,7 +31,7 @@ bool ToggleMinimized() {
|
| mru_windows.front()->GetWindowState()->Activate();
|
| return true;
|
| }
|
| - wm::WindowState* window_state = wm::GetWindowState(window);
|
| + wm::WindowState* window_state = window->GetWindowState();
|
| if (!window_state->CanMinimize())
|
| return false;
|
| window_state->Minimize();
|
| @@ -39,80 +39,20 @@ bool ToggleMinimized() {
|
| }
|
|
|
| void ToggleMaximized() {
|
| - wm::WindowState* window_state = wm::GetActiveWindowState();
|
| - if (!window_state)
|
| + WmWindow* active_window = WmShell::Get()->GetActiveWindow();
|
| + if (!active_window)
|
| return;
|
| base::RecordAction(base::UserMetricsAction("Accel_Toggle_Maximized"));
|
| wm::WMEvent event(wm::WM_EVENT_TOGGLE_MAXIMIZE);
|
| - window_state->OnWMEvent(&event);
|
| + active_window->GetWindowState()->OnWMEvent(&event);
|
| }
|
|
|
| void ToggleFullscreen() {
|
| - wm::WindowState* window_state = wm::GetActiveWindowState();
|
| - if (window_state) {
|
| - const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
|
| - window_state->OnWMEvent(&event);
|
| - }
|
| -}
|
| -
|
| -void ToggleTouchHudProjection() {
|
| - base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear"));
|
| - bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled();
|
| - Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled);
|
| -}
|
| -
|
| -bool IsInternalDisplayZoomEnabled() {
|
| - DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| - return display_manager->IsDisplayUIScalingEnabled() ||
|
| - display_manager->IsInUnifiedMode();
|
| -}
|
| -
|
| -bool ZoomInternalDisplay(bool up) {
|
| - if (up)
|
| - base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up"));
|
| - else
|
| - base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down"));
|
| -
|
| - DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| -
|
| - int64_t display_id = display_manager->IsInUnifiedMode()
|
| - ? DisplayManager::kUnifiedDisplayId
|
| - : display_manager->GetDisplayIdForUIScaling();
|
| - const DisplayInfo& display_info = display_manager->GetDisplayInfo(display_id);
|
| - DisplayMode mode;
|
| -
|
| - if (display_manager->IsInUnifiedMode()) {
|
| - if (!GetDisplayModeForNextResolution(display_info, up, &mode))
|
| - return false;
|
| - } else {
|
| - if (!GetDisplayModeForNextUIScale(display_info, up, &mode))
|
| - return false;
|
| - }
|
| - return display_manager->SetDisplayMode(display_id, mode);
|
| -}
|
| -
|
| -void ResetInternalDisplayZoom() {
|
| - base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset"));
|
| - DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| -
|
| - if (display_manager->IsInUnifiedMode()) {
|
| - const DisplayInfo& display_info =
|
| - display_manager->GetDisplayInfo(DisplayManager::kUnifiedDisplayId);
|
| - const std::vector<DisplayMode>& modes = display_info.display_modes();
|
| - auto iter =
|
| - std::find_if(modes.begin(), modes.end(),
|
| - [](const DisplayMode& mode) { return mode.native; });
|
| - display_manager->SetDisplayMode(DisplayManager::kUnifiedDisplayId, *iter);
|
| - } else {
|
| - SetDisplayUIScale(display_manager->GetDisplayIdForUIScaling(), 1.0f);
|
| - }
|
| -}
|
| -
|
| -void Unpin() {
|
| - WmWindow* pinned_window =
|
| - Shell::GetInstance()->screen_pinning_controller()->pinned_window();
|
| - if (pinned_window)
|
| - pinned_window->GetWindowState()->Restore();
|
| + WmWindow* active_window = WmShell::Get()->GetActiveWindow();
|
| + if (!active_window)
|
| + return;
|
| + const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
|
| + active_window->GetWindowState()->OnWMEvent(&event);
|
| }
|
|
|
| } // namespace accelerators
|
|
|