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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 1263853002: Unified Desktop: Support 2xDSF display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/accelerators/accelerator_commands.cc ('k') | ash/display/display_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index be2cdbf1c1ea1f4f270022275e29fbd75481e274..6ef3ac658131cddc0fdc48f8431771fdfd1f5899 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -12,8 +12,6 @@
#include "ash/accelerators/debug_commands.h"
#include "ash/ash_switches.h"
#include "ash/debug.h"
-#include "ash/display/display_manager.h"
-#include "ash/display/display_util.h"
#include "ash/display/window_tree_host_manager.h"
#include "ash/focus_cycler.h"
#include "ash/gpu_support.h"
@@ -288,53 +286,6 @@ void HandleRotateActiveWindow() {
}
}
-void HandleScaleReset() {
- base::RecordAction(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 CanHandleScaleUI() {
- DisplayManager* display_manager = Shell::GetInstance()->display_manager();
- return display_manager->IsDisplayUIScalingEnabled() ||
- display_manager->IsInUnifiedMode();
-}
-
-void HandleScaleUI(bool up) {
- if (up)
- base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Up"));
- else
- base::RecordAction(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;
- } else {
- if (!GetDisplayModeForNextUIScale(display_info, up, &mode))
- return;
- }
- display_manager->SetDisplayMode(display_id, mode);
-}
-
void HandleShowKeyboardOverlay() {
base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay"));
ash::Shell::GetInstance()->new_window_delegate()->ShowKeyboardOverlay();
@@ -886,7 +837,7 @@ bool AcceleratorController::CanPerformAction(
case SCALE_UI_RESET:
case SCALE_UI_UP:
case SCALE_UI_DOWN:
- return CanHandleScaleUI();
+ return accelerators::IsInternalDisplayZoomEnabled();
case SHOW_MESSAGE_CENTER_BUBBLE:
return CanHandleShowMessageCenterBubble();
case SWITCH_IME:
@@ -1095,13 +1046,13 @@ void AcceleratorController::PerformAction(AcceleratorAction action,
HandleRotateActiveWindow();
break;
case SCALE_UI_DOWN:
- HandleScaleUI(false /* down */);
+ accelerators::ZoomInternalDisplay(false /* down */);
break;
case SCALE_UI_RESET:
- HandleScaleReset();
+ accelerators::ResetInternalDisplayZoom();
break;
case SCALE_UI_UP:
- HandleScaleUI(true /* up */);
+ accelerators::ZoomInternalDisplay(true /* up */);
break;
case SHOW_KEYBOARD_OVERLAY:
HandleShowKeyboardOverlay();
« no previous file with comments | « ash/accelerators/accelerator_commands.cc ('k') | ash/display/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698