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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 12505005: Store rotation/ui scale to local state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « no previous file | ash/accelerators/accelerator_table.cc » ('j') | ash/display/display_change_observer_x11.cc » ('J')
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 79f8f414517660ae3540d289537ac88da4a2ae42..9a1f309e01c8752f48e2c2c74c332e6a7a2127de 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -170,24 +170,6 @@ gfx::Display::Rotation GetNextRotation(gfx::Display::Rotation current) {
return gfx::Display::ROTATE_0;
}
-float GetNextScale(float scale, bool up) {
- // These scales are equivalent to 1024, 1280, 1600 and 1920 pixel width
- // respectively on 2560 pixel width 2x density display.
- static const float kScales[] = {0.8f, 1.0f, 1.25f, 1.5f};
- static const size_t kScaleTableSize = arraysize(kScales);
- for (size_t i = 0; i < kScaleTableSize; ++i) {
- if (kScales[i] == scale) {
- if (up && i != kScaleTableSize -1)
- return kScales[i + 1];
- if (!up && i != 0)
- return kScales[i - 1];
- return kScales[i];
- }
- }
- // Fallback to 1.0f if the |scale| wasn't in the list.
- return 1.0f;
-}
-
bool HandleScaleUI(bool up) {
// UI Scaling is effective only on internal display.
int64 display_id = gfx::Display::InternalDisplayId();
@@ -196,12 +178,11 @@ bool HandleScaleUI(bool up) {
if (!base::chromeos::IsRunningOnChromeOS())
display_id = Shell::GetInstance()->display_manager()->first_display_id();
#endif
- const gfx::Display& display = Shell::GetInstance()->display_manager()->
- GetDisplayForId(display_id);
const DisplayInfo& display_info = Shell::GetInstance()->display_manager()->
- GetDisplayInfo(display);
+ GetDisplayInfo(display_id);
Shell::GetInstance()->display_manager()->SetDisplayUIScale(
- display.id(), GetNextScale(display_info.ui_scale(), up));
+ display_id,
+ internal::DisplayManager::GetNextUIScale(display_info.ui_scale(), up));
return true;
}
@@ -210,7 +191,7 @@ bool HandleRotateScreen() {
gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point);
const DisplayInfo& display_info =
- Shell::GetInstance()->display_manager()->GetDisplayInfo(display);
+ Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id());
Shell::GetInstance()->display_manager()->SetDisplayRotation(
display.id(), GetNextRotation(display_info.rotation()));
return true;
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.cc » ('j') | ash/display/display_change_observer_x11.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698