| 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_aura.h" | 5 #include "ash/accelerators/accelerator_commands_aura.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
| 8 #include "ash/common/wm_window.h" | 8 #include "ash/common/wm_window.h" |
| 9 #include "ash/display/display_manager.h" | |
| 10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 11 #include "ash/wm/screen_pinning_controller.h" | 10 #include "ash/wm/screen_pinning_controller.h" |
| 12 #include "base/metrics/user_metrics.h" | 11 #include "base/metrics/user_metrics.h" |
| 12 #include "ui/display/manager/display_manager.h" |
| 13 #include "ui/display/manager/managed_display_info.h" | 13 #include "ui/display/manager/managed_display_info.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 namespace accelerators { | 16 namespace accelerators { |
| 17 | 17 |
| 18 void ToggleTouchHudProjection() { | 18 void ToggleTouchHudProjection() { |
| 19 base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear")); | 19 base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear")); |
| 20 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); | 20 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); |
| 21 Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); | 21 Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool IsInternalDisplayZoomEnabled() { | 24 bool IsInternalDisplayZoomEnabled() { |
| 25 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 25 display::DisplayManager* display_manager = |
| 26 Shell::GetInstance()->display_manager(); |
| 26 return display_manager->IsDisplayUIScalingEnabled() || | 27 return display_manager->IsDisplayUIScalingEnabled() || |
| 27 display_manager->IsInUnifiedMode(); | 28 display_manager->IsInUnifiedMode(); |
| 28 } | 29 } |
| 29 | 30 |
| 30 bool ZoomInternalDisplay(bool up) { | 31 bool ZoomInternalDisplay(bool up) { |
| 31 if (up) | 32 if (up) |
| 32 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up")); | 33 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up")); |
| 33 else | 34 else |
| 34 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down")); | 35 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down")); |
| 35 | 36 |
| 36 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 37 display::DisplayManager* display_manager = |
| 38 Shell::GetInstance()->display_manager(); |
| 37 return display_manager->ZoomInternalDisplay(up); | 39 return display_manager->ZoomInternalDisplay(up); |
| 38 } | 40 } |
| 39 | 41 |
| 40 void ResetInternalDisplayZoom() { | 42 void ResetInternalDisplayZoom() { |
| 41 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset")); | 43 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset")); |
| 42 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 44 display::DisplayManager* display_manager = |
| 45 Shell::GetInstance()->display_manager(); |
| 43 display_manager->ResetInternalDisplayZoom(); | 46 display_manager->ResetInternalDisplayZoom(); |
| 44 } | 47 } |
| 45 | 48 |
| 46 void Unpin() { | 49 void Unpin() { |
| 47 WmWindow* pinned_window = | 50 WmWindow* pinned_window = |
| 48 Shell::GetInstance()->screen_pinning_controller()->pinned_window(); | 51 Shell::GetInstance()->screen_pinning_controller()->pinned_window(); |
| 49 if (pinned_window) | 52 if (pinned_window) |
| 50 pinned_window->GetWindowState()->Restore(); | 53 pinned_window->GetWindowState()->Restore(); |
| 51 } | 54 } |
| 52 | 55 |
| 53 } // namespace accelerators | 56 } // namespace accelerators |
| 54 } // namespace ash | 57 } // namespace ash |
| OLD | NEW |