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

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

Issue 1263853002: Unified Desktop: Support 2xDSF display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « ash/accelerators/accelerator_commands.h ('k') | ash/accelerators/accelerator_controller.cc » ('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/display/display_manager.h"
8 #include "ash/display/display_util.h"
7 #include "ash/shell.h" 9 #include "ash/shell.h"
8 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
9 #include "ash/wm/mru_window_tracker.h" 11 #include "ash/wm/mru_window_tracker.h"
10 #include "ash/wm/window_state.h" 12 #include "ash/wm/window_state.h"
11 #include "ash/wm/window_util.h" 13 #include "ash/wm/window_util.h"
12 #include "ash/wm/wm_event.h" 14 #include "ash/wm/wm_event.h"
13 #include "base/metrics/user_metrics.h" 15 #include "base/metrics/user_metrics.h"
14 16
15 namespace ash { 17 namespace ash {
16 namespace accelerators { 18 namespace accelerators {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 window_state->OnWMEvent(&event); 51 window_state->OnWMEvent(&event);
50 } 52 }
51 } 53 }
52 54
53 void ToggleTouchHudProjection() { 55 void ToggleTouchHudProjection() {
54 base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear")); 56 base::RecordAction(base::UserMetricsAction("Accel_Touch_Hud_Clear"));
55 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled(); 57 bool enabled = Shell::GetInstance()->is_touch_hud_projection_enabled();
56 Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled); 58 Shell::GetInstance()->SetTouchHudProjectionEnabled(!enabled);
57 } 59 }
58 60
61 bool IsInternalDisplayZoomEnabled() {
62 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
63 return display_manager->IsDisplayUIScalingEnabled() ||
64 display_manager->IsInUnifiedMode();
65 }
66
67 bool ZoomInternalDisplay(bool up) {
68 if (up)
69 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up"));
70 else
71 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down"));
72
73 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
74
75 int64 display_id = display_manager->IsInUnifiedMode()
76 ? DisplayManager::kUnifiedDisplayId
77 : display_manager->GetDisplayIdForUIScaling();
78 const DisplayInfo& display_info = display_manager->GetDisplayInfo(display_id);
79 DisplayMode mode;
80
81 if (display_manager->IsInUnifiedMode()) {
82 if (!GetDisplayModeForNextResolution(display_info, up, &mode))
83 return false;
84 } else {
85 if (!GetDisplayModeForNextUIScale(display_info, up, &mode))
86 return false;
87 }
88 return display_manager->SetDisplayMode(display_id, mode);
89 }
90
91 void ResetInternalDisplayZoom() {
92 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset"));
93 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
94
95 if (display_manager->IsInUnifiedMode()) {
96 const DisplayInfo& display_info =
97 display_manager->GetDisplayInfo(DisplayManager::kUnifiedDisplayId);
98 const std::vector<DisplayMode>& modes = display_info.display_modes();
99 auto iter =
100 std::find_if(modes.begin(), modes.end(),
101 [](const DisplayMode& mode) { return mode.native; });
102 display_manager->SetDisplayMode(DisplayManager::kUnifiedDisplayId, *iter);
103 } else {
104 SetDisplayUIScale(display_manager->GetDisplayIdForUIScaling(), 1.0f);
105 }
106 }
107
59 } // namespace accelerators 108 } // namespace accelerators
60 } // namespace ash 109 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_commands.h ('k') | ash/accelerators/accelerator_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698