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

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
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 ZoomInternalDisplay(bool up) {
62 if (up)
63 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Up"));
64 else
65 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Down"));
66
67 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
68
69 int64 display_id = display_manager->IsInUnifiedMode()
70 ? DisplayManager::kUnifiedDisplayId
71 : display_manager->GetDisplayIdForUIScaling();
72 const DisplayInfo& display_info = display_manager->GetDisplayInfo(display_id);
73 DisplayMode mode;
74
75 if (display_manager->IsInUnifiedMode()) {
76 if (!GetDisplayModeForNextResolution(display_info, up, &mode))
77 return false;
78 } else {
79 if (!GetDisplayModeForNextUIScale(display_info, up, &mode))
80 return false;
81 }
82 return display_manager->SetDisplayMode(display_id, mode);
83 }
84
85 void ResetInternalDisplayZoom() {
86 base::RecordAction(base::UserMetricsAction("Accel_Scale_Ui_Reset"));
87 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
88
89 if (display_manager->IsInUnifiedMode()) {
90 const DisplayInfo& display_info =
91 display_manager->GetDisplayInfo(DisplayManager::kUnifiedDisplayId);
92 const std::vector<DisplayMode>& modes = display_info.display_modes();
93 auto iter =
94 std::find_if(modes.begin(), modes.end(),
95 [](const DisplayMode& mode) { return mode.native; });
96 display_manager->SetDisplayMode(DisplayManager::kUnifiedDisplayId, *iter);
97 } else {
98 SetDisplayUIScale(display_manager->GetDisplayIdForUIScaling(), 1.0f);
99 }
100 }
101
102 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.
103 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
104 return display_manager->IsDisplayUIScalingEnabled() ||
105 display_manager->IsInUnifiedMode();
106 }
107
59 } // namespace accelerators 108 } // namespace accelerators
60 } // namespace ash 109 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698