Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "ash/accelerators/accelerator_table.h" | 11 #include "ash/accelerators/accelerator_table.h" |
| 12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
| 13 #include "ash/caps_lock_delegate.h" | 13 #include "ash/caps_lock_delegate.h" |
| 14 #include "ash/desktop_background/desktop_background_controller.h" | 14 #include "ash/desktop_background/desktop_background_controller.h" |
| 15 #include "ash/display/display_controller.h" | 15 #include "ash/display/display_controller.h" |
| 16 #include "ash/display/multi_display_manager.h" | 16 #include "ash/display/multi_display_manager.h" |
| 17 #include "ash/focus_cycler.h" | 17 #include "ash/focus_cycler.h" |
| 18 #include "ash/ime_control_delegate.h" | 18 #include "ash/ime_control_delegate.h" |
| 19 #include "ash/launcher/launcher.h" | 19 #include "ash/launcher/launcher.h" |
| 20 #include "ash/launcher/launcher_delegate.h" | 20 #include "ash/launcher/launcher_delegate.h" |
| 21 #include "ash/launcher/launcher_model.h" | 21 #include "ash/launcher/launcher_model.h" |
| 22 #include "ash/magnifier/magnification_controller.h" | 22 #include "ash/magnifier/magnification_controller.h" |
| 23 #include "ash/magnifier/partial_magnification_controller.h" | |
| 23 #include "ash/root_window_controller.h" | 24 #include "ash/root_window_controller.h" |
| 24 #include "ash/rotator/screen_rotation.h" | 25 #include "ash/rotator/screen_rotation.h" |
| 25 #include "ash/screen_ash.h" | 26 #include "ash/screen_ash.h" |
| 26 #include "ash/screenshot_delegate.h" | 27 #include "ash/screenshot_delegate.h" |
| 27 #include "ash/shell.h" | 28 #include "ash/shell.h" |
| 28 #include "ash/shell_delegate.h" | 29 #include "ash/shell_delegate.h" |
| 29 #include "ash/shell_window_ids.h" | 30 #include "ash/shell_window_ids.h" |
| 30 #include "ash/system/brightness/brightness_control_delegate.h" | 31 #include "ash/system/brightness/brightness_control_delegate.h" |
| 31 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" | 32 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
| 32 #include "ash/system/status_area_widget.h" | 33 #include "ash/system/status_area_widget.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 return true; | 222 return true; |
| 222 } | 223 } |
| 223 | 224 |
| 224 bool HandleToggleRootWindowFullScreen() { | 225 bool HandleToggleRootWindowFullScreen() { |
| 225 Shell::GetPrimaryRootWindow()->ToggleFullScreen(); | 226 Shell::GetPrimaryRootWindow()->ToggleFullScreen(); |
| 226 return true; | 227 return true; |
| 227 } | 228 } |
| 228 | 229 |
| 229 // Magnify the screen | 230 // Magnify the screen |
| 230 bool HandleMagnifyScreen(int delta_index) { | 231 bool HandleMagnifyScreen(int delta_index) { |
| 231 // TODO(yoshiki): Create the class like MagnifierStepScaleController, and | 232 if (ash::Shell::GetInstance()->magnification_controller()->IsEnabled()) { |
| 232 // move the following scale control to it. | 233 // TODO(yoshiki): Create the class like MagnifierStepScaleController, and |
| 233 float scale = | 234 // move the following scale control to it. |
| 234 ash::Shell::GetInstance()->magnification_controller()->GetScale(); | 235 float scale = |
| 235 // Calculate rounded logarithm (base kMagnificationFactor) of scale. | 236 ash::Shell::GetInstance()->magnification_controller()->GetScale(); |
| 236 int scale_index = | 237 // Calculate rounded logarithm (base kMagnificationFactor) of scale. |
| 237 std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5); | 238 int scale_index = |
| 239 std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5); | |
| 238 | 240 |
| 239 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); | 241 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); |
| 240 | 242 |
| 241 ash::Shell::GetInstance()->magnification_controller()-> | 243 ash::Shell::GetInstance()->magnification_controller()-> |
| 242 SetScale(std::pow(kMagnificationFactor, new_scale_index), true); | 244 SetScale(std::pow(kMagnificationFactor, new_scale_index), true); |
| 245 } else if (ash::Shell::GetInstance() | |
| 246 ->partial_magnification_controller()->IsEnabled()) { | |
|
sky
2012/11/12 15:23:46
nit: -> on previous line (you do on 248).
Zachary Kuznia
2012/11/13 08:16:15
Done.
| |
| 247 float scale = delta_index > 0 ? kDefaultPartialMagnifiedScale : 1; | |
| 248 ash::Shell::GetInstance()->partial_magnification_controller()-> | |
| 249 SetScale(scale); | |
| 250 } | |
| 243 | 251 |
| 244 return true; | 252 return true; |
| 245 } | 253 } |
| 246 | 254 |
| 247 bool HandleMediaNextTrack() { | 255 bool HandleMediaNextTrack() { |
| 248 Shell::GetInstance()->delegate()->HandleMediaNextTrack(); | 256 Shell::GetInstance()->delegate()->HandleMediaNextTrack(); |
| 249 return true; | 257 return true; |
| 250 } | 258 } |
| 251 | 259 |
| 252 bool HandleMediaPlayPause() { | 260 bool HandleMediaPlayPause() { |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 keyboard_brightness_control_delegate) { | 882 keyboard_brightness_control_delegate) { |
| 875 keyboard_brightness_control_delegate_ = | 883 keyboard_brightness_control_delegate_ = |
| 876 keyboard_brightness_control_delegate.Pass(); | 884 keyboard_brightness_control_delegate.Pass(); |
| 877 } | 885 } |
| 878 | 886 |
| 879 bool AcceleratorController::CanHandleAccelerators() const { | 887 bool AcceleratorController::CanHandleAccelerators() const { |
| 880 return true; | 888 return true; |
| 881 } | 889 } |
| 882 | 890 |
| 883 } // namespace ash | 891 } // namespace ash |
| OLD | NEW |