Chromium Code Reviews| Index: ash/accelerators/accelerator_controller.cc |
| diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc |
| index 2762f944573416de07351998dba4e09d1683d458..f555ea4a537269521750ab63c628dee1d2022032 100644 |
| --- a/ash/accelerators/accelerator_controller.cc |
| +++ b/ash/accelerators/accelerator_controller.cc |
| @@ -4,6 +4,8 @@ |
| #include "ash/accelerators/accelerator_controller.h" |
| +#include <cmath> |
| + |
| #include "ash/accelerators/accelerator_table.h" |
| #include "ash/ash_switches.h" |
| #include "ash/caps_lock_delegate.h" |
| @@ -13,6 +15,7 @@ |
| #include "ash/launcher/launcher.h" |
| #include "ash/launcher/launcher_delegate.h" |
| #include "ash/launcher/launcher_model.h" |
| +#include "ash/magnifier/magnification_controller.h" |
| #include "ash/monitor/multi_monitor_manager.h" |
| #include "ash/screenshot_delegate.h" |
| #include "ash/shell.h" |
| @@ -39,6 +42,10 @@ |
| namespace { |
| +// Factor of magnification scale. For example, when this value is 1.2, scale |
| +// value will be changed x1.0, x1.2, x1.44, ... |
| +const float kMagnificationFactor = 1.2; |
| + |
| bool HandleCycleWindowMRU(ash::WindowCycleController::Direction direction, |
| bool is_alt_down) { |
| ash::Shell::GetInstance()-> |
| @@ -171,6 +178,17 @@ bool HandlePrintWindowHierarchy() { |
| return true; |
| } |
| +// Mafnify the screen |
|
sky
2012/06/11 16:19:14
Magnify the screen.
yoshiki
2012/06/19 17:56:16
Done.
|
| +bool HandleMagnifyScreen(int delta_index) { |
| + static int scale_index = 0; |
| + scale_index = std::max(0, std::min(8, scale_index + delta_index)); |
|
sky
2012/06/11 16:19:14
Why is this static here? Shouldn't the value live
yoshiki
2012/06/19 17:56:16
Done.
|
| + |
| + ash::Shell::GetInstance()->magnification_controller()-> |
| + SetScale(std::pow(kMagnificationFactor, scale_index), true); |
|
sky
2012/06/11 16:19:14
indent 4
yoshiki
2012/06/19 17:56:16
Done.
|
| + |
| + return true; |
| +} |
| + |
| #endif |
| } // namespace |
| @@ -470,6 +488,10 @@ bool AcceleratorController::AcceleratorPressed( |
| case MONITOR_TOGGLE_SCALE: |
| internal::MultiMonitorManager::ToggleMonitorScale(); |
| return true; |
| + case MAGNIFY_SCREEN_ZOOM_IN: |
| + return HandleMagnifyScreen(1); |
| + case MAGNIFY_SCREEN_ZOOM_OUT: |
| + return HandleMagnifyScreen(-1); |
| #endif |
| default: |
| NOTREACHED() << "Unhandled action " << it->second; |