Chromium Code Reviews| Index: ash/accelerators/accelerator_commands.cc |
| diff --git a/ash/accelerators/accelerator_commands.cc b/ash/accelerators/accelerator_commands.cc |
| index c49ed5020ea6440971f5a1a62e0ba7c7664c1136..8513674e8492546bbacb4181389d7eab8b6f68ce 100644 |
| --- a/ash/accelerators/accelerator_commands.cc |
| +++ b/ash/accelerators/accelerator_commands.cc |
| @@ -4,6 +4,8 @@ |
| #include "ash/accelerators/accelerator_commands.h" |
| +#include "ash/display/display_manager.h" |
| +#include "ash/display/display_util.h" |
| #include "ash/shell.h" |
| #include "ash/shell_delegate.h" |
| #include "ash/wm/mru_window_tracker.h" |
| @@ -56,5 +58,52 @@ void ToggleTouchHudProjection() { |
| Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); |
| } |
| +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 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); |
| + } |
| +} |
| + |
| +bool IsInternalDisplayZoomEnabled() { |
|
Jun Mukai
2015/07/29 21:26:28
Be sure to appear in the same order in .h and .cc
oshima
2015/07/30 01:33:31
Done.
|
| + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| + return display_manager->IsDisplayUIScalingEnabled() || |
| + display_manager->IsInUnifiedMode(); |
| +} |
| + |
| } // namespace accelerators |
| } // namespace ash |