Chromium Code Reviews| Index: ash/accelerators/accelerator_controller.cc |
| diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc |
| index 8b9f9d4c4cdcf3c3b5d0a2da7034290a7a2389c1..386d9c119680f5234ea9ffe4b6348a9dd980080f 100644 |
| --- a/ash/accelerators/accelerator_controller.cc |
| +++ b/ash/accelerators/accelerator_controller.cc |
| @@ -71,6 +71,8 @@ |
| #include "base/chromeos/chromeos_version.h" |
| #endif // defined(OS_CHROMEOS) |
| +#include "ash/display/display_info.h" |
|
oshima
2013/07/31 16:39:11
Changes in this file is just for my testing and I'
Daniel Erat
2013/07/31 17:34:05
am i misunderstanding? the change in e.g. HandleSc
oshima
2013/07/31 21:59:49
Sorry if it wasn't clear enough.
It was for me to
|
| + |
| namespace ash { |
| namespace { |
| @@ -193,13 +195,45 @@ gfx::Display::Rotation GetNextRotation(gfx::Display::Rotation current) { |
| case gfx::Display::ROTATE_270: |
| return gfx::Display::ROTATE_0; |
| } |
| - NOTREACHED() << "Unknown rotation:" << current; |
| + NOTREACHED() << "Unknown rotatgion:" << current; |
|
Daniel Erat
2013/07/31 17:34:05
nit: s/rotatgion/rotation/
|
| return gfx::Display::ROTATE_0; |
| } |
| +const gfx::Size& FindNextResolution( |
| + const std::vector<internal::Resolution>& resolutions, |
| + const gfx::Size& current_resolution) { |
| + std::vector<internal::Resolution>::const_iterator iter = |
| + resolutions.begin(); |
| + for (; iter != resolutions.end(); ++iter) { |
| + if (iter->size == current_resolution) { |
| + ++iter; |
| + break; |
| + } |
| + } |
| + if (iter == resolutions.end()) |
| + return resolutions[0].size; |
| + else |
| + return iter->size; |
| +} |
| + |
| bool HandleScaleUI(bool up) { |
| internal::DisplayManager* display_manager = |
| Shell::GetInstance()->display_manager(); |
| + |
| + gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint(); |
| + gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point); |
| + if (!display.IsInternal()) { |
| + const DisplayInfo& info = display_manager->GetDisplayInfo(display.id()); |
| + if (info.resolutions().empty()) { |
| + LOG(ERROR) << "No resolution found:"; |
| + return false; |
| + } |
| + const gfx::Size& next_resolution = |
| + FindNextResolution(info.resolutions(), info.bounds_in_pixel().size()); |
| + display_manager->SetDisplayResolution(display.id(), next_resolution); |
| + return true; |
| + } |
| + |
| int64 display_id = display_manager->GetDisplayIdForUIScaling(); |
| if (display_id == gfx::Display::kInvalidDisplayID) |
| return false; |