| 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/desktop_background/user_wallpaper_delegate.h" | 15 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 16 #include "ash/display/display_controller.h" | 16 #include "ash/display/display_controller.h" |
| 17 #include "ash/display/display_manager.h" | 17 #include "ash/display/display_manager.h" |
| 18 #include "ash/focus_cycler.h" | 18 #include "ash/focus_cycler.h" |
| 19 #include "ash/ime_control_delegate.h" | 19 #include "ash/ime_control_delegate.h" |
| 20 #include "ash/launcher/launcher.h" | 20 #include "ash/launcher/launcher.h" |
| 21 #include "ash/launcher/launcher_delegate.h" | 21 #include "ash/launcher/launcher_delegate.h" |
| 22 #include "ash/launcher/launcher_model.h" | 22 #include "ash/launcher/launcher_model.h" |
| 23 #include "ash/magnifier/magnification_controller.h" | 23 #include "ash/magnifier/magnification_controller.h" |
| 24 #include "ash/magnifier/partial_magnification_controller.h" |
| 24 #include "ash/root_window_controller.h" | 25 #include "ash/root_window_controller.h" |
| 25 #include "ash/rotator/screen_rotation.h" | 26 #include "ash/rotator/screen_rotation.h" |
| 26 #include "ash/screen_ash.h" | 27 #include "ash/screen_ash.h" |
| 27 #include "ash/screenshot_delegate.h" | 28 #include "ash/screenshot_delegate.h" |
| 28 #include "ash/shell.h" | 29 #include "ash/shell.h" |
| 29 #include "ash/shell_delegate.h" | 30 #include "ash/shell_delegate.h" |
| 30 #include "ash/shell_window_ids.h" | 31 #include "ash/shell_window_ids.h" |
| 31 #include "ash/system/brightness/brightness_control_delegate.h" | 32 #include "ash/system/brightness/brightness_control_delegate.h" |
| 32 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" | 33 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
| 33 #include "ash/system/status_area_widget.h" | 34 #include "ash/system/status_area_widget.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 224 | 225 |
| 225 bool HandleToggleRootWindowFullScreen() { | 226 bool HandleToggleRootWindowFullScreen() { |
| 226 Shell::GetPrimaryRootWindow()->ToggleFullScreen(); | 227 Shell::GetPrimaryRootWindow()->ToggleFullScreen(); |
| 227 return true; | 228 return true; |
| 228 } | 229 } |
| 229 | 230 |
| 230 // Magnify the screen | 231 // Magnify the screen |
| 231 bool HandleMagnifyScreen(int delta_index) { | 232 bool HandleMagnifyScreen(int delta_index) { |
| 232 // TODO(yoshiki): Create the class like MagnifierStepScaleController, and | 233 if (ash::Shell::GetInstance()->magnification_controller()->IsEnabled()) { |
| 233 // move the following scale control to it. | 234 // TODO(yoshiki): Create the class like MagnifierStepScaleController, and |
| 234 float scale = | 235 // move the following scale control to it. |
| 235 ash::Shell::GetInstance()->magnification_controller()->GetScale(); | 236 float scale = |
| 236 // Calculate rounded logarithm (base kMagnificationFactor) of scale. | 237 ash::Shell::GetInstance()->magnification_controller()->GetScale(); |
| 237 int scale_index = | 238 // Calculate rounded logarithm (base kMagnificationFactor) of scale. |
| 238 std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5); | 239 int scale_index = |
| 240 std::floor(std::log(scale) / std::log(kMagnificationFactor) + 0.5); |
| 239 | 241 |
| 240 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); | 242 int new_scale_index = std::max(0, std::min(8, scale_index + delta_index)); |
| 241 | 243 |
| 242 ash::Shell::GetInstance()->magnification_controller()-> | 244 ash::Shell::GetInstance()->magnification_controller()-> |
| 243 SetScale(std::pow(kMagnificationFactor, new_scale_index), true); | 245 SetScale(std::pow(kMagnificationFactor, new_scale_index), true); |
| 246 } else if (ash::Shell::GetInstance()-> |
| 247 partial_magnification_controller()->is_enabled()) { |
| 248 float scale = delta_index > 0 ? kDefaultPartialMagnifiedScale : 1; |
| 249 ash::Shell::GetInstance()->partial_magnification_controller()-> |
| 250 SetScale(scale); |
| 251 } |
| 244 | 252 |
| 245 return true; | 253 return true; |
| 246 } | 254 } |
| 247 | 255 |
| 248 bool HandleMediaNextTrack() { | 256 bool HandleMediaNextTrack() { |
| 249 Shell::GetInstance()->delegate()->HandleMediaNextTrack(); | 257 Shell::GetInstance()->delegate()->HandleMediaNextTrack(); |
| 250 return true; | 258 return true; |
| 251 } | 259 } |
| 252 | 260 |
| 253 bool HandleMediaPlayPause() { | 261 bool HandleMediaPlayPause() { |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 keyboard_brightness_control_delegate) { | 880 keyboard_brightness_control_delegate) { |
| 873 keyboard_brightness_control_delegate_ = | 881 keyboard_brightness_control_delegate_ = |
| 874 keyboard_brightness_control_delegate.Pass(); | 882 keyboard_brightness_control_delegate.Pass(); |
| 875 } | 883 } |
| 876 | 884 |
| 877 bool AcceleratorController::CanHandleAccelerators() const { | 885 bool AcceleratorController::CanHandleAccelerators() const { |
| 878 return true; | 886 return true; |
| 879 } | 887 } |
| 880 | 888 |
| 881 } // namespace ash | 889 } // namespace ash |
| OLD | NEW |