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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 10388141: Full-screen Magnifier: Support warping the cursor on the edge (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Review fix Created 8 years, 6 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 unified diff | Download patch
OLDNEW
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 <cmath>
8
7 #include "ash/accelerators/accelerator_table.h" 9 #include "ash/accelerators/accelerator_table.h"
8 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
9 #include "ash/caps_lock_delegate.h" 11 #include "ash/caps_lock_delegate.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 12 #include "ash/desktop_background/desktop_background_controller.h"
11 #include "ash/focus_cycler.h" 13 #include "ash/focus_cycler.h"
12 #include "ash/ime_control_delegate.h" 14 #include "ash/ime_control_delegate.h"
13 #include "ash/launcher/launcher.h" 15 #include "ash/launcher/launcher.h"
14 #include "ash/launcher/launcher_delegate.h" 16 #include "ash/launcher/launcher_delegate.h"
15 #include "ash/launcher/launcher_model.h" 17 #include "ash/launcher/launcher_model.h"
18 #include "ash/magnifier/magnification_controller.h"
16 #include "ash/monitor/multi_monitor_manager.h" 19 #include "ash/monitor/multi_monitor_manager.h"
17 #include "ash/screenshot_delegate.h" 20 #include "ash/screenshot_delegate.h"
18 #include "ash/shell.h" 21 #include "ash/shell.h"
19 #include "ash/shell_delegate.h" 22 #include "ash/shell_delegate.h"
20 #include "ash/shell_window_ids.h" 23 #include "ash/shell_window_ids.h"
21 #include "ash/system/brightness/brightness_control_delegate.h" 24 #include "ash/system/brightness/brightness_control_delegate.h"
22 #include "ash/system/tray/system_tray.h" 25 #include "ash/system/tray/system_tray.h"
23 #include "ash/volume_control_delegate.h" 26 #include "ash/volume_control_delegate.h"
24 #include "ash/wm/property_util.h" 27 #include "ash/wm/property_util.h"
25 #include "ash/wm/window_cycle_controller.h" 28 #include "ash/wm/window_cycle_controller.h"
26 #include "ash/wm/window_util.h" 29 #include "ash/wm/window_util.h"
27 #include "ash/wm/workspace/snap_sizer.h" 30 #include "ash/wm/workspace/snap_sizer.h"
28 #include "base/command_line.h" 31 #include "base/command_line.h"
29 #include "ui/aura/event.h" 32 #include "ui/aura/event.h"
30 #include "ui/aura/root_window.h" 33 #include "ui/aura/root_window.h"
31 #include "ui/base/accelerators/accelerator.h" 34 #include "ui/base/accelerators/accelerator.h"
32 #include "ui/base/accelerators/accelerator_manager.h" 35 #include "ui/base/accelerators/accelerator_manager.h"
33 #include "ui/compositor/debug_utils.h" 36 #include "ui/compositor/debug_utils.h"
34 #include "ui/compositor/layer.h" 37 #include "ui/compositor/layer.h"
35 #include "ui/compositor/layer_animation_sequence.h" 38 #include "ui/compositor/layer_animation_sequence.h"
36 #include "ui/compositor/layer_animator.h" 39 #include "ui/compositor/layer_animator.h"
37 #include "ui/compositor/screen_rotation.h" 40 #include "ui/compositor/screen_rotation.h"
38 #include "ui/oak/oak.h" 41 #include "ui/oak/oak.h"
39 42
40 namespace { 43 namespace {
41 44
45 // Factor of magnification scale. For example, when this value is 1.2, scale
46 // value will be changed x1.0, x1.2, x1.44, ...
47 const float kMagnificationFactor = 1.2;
48
42 bool HandleCycleWindowMRU(ash::WindowCycleController::Direction direction, 49 bool HandleCycleWindowMRU(ash::WindowCycleController::Direction direction,
43 bool is_alt_down) { 50 bool is_alt_down) {
44 ash::Shell::GetInstance()-> 51 ash::Shell::GetInstance()->
45 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down); 52 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down);
46 // Always report we handled the key, even if the window didn't change. 53 // Always report we handled the key, even if the window didn't change.
47 return true; 54 return true;
48 } 55 }
49 56
50 void HandleCycleWindowLinear(ash::CycleDirection direction) { 57 void HandleCycleWindowLinear(ash::CycleDirection direction) {
51 ash::Shell::GetInstance()->launcher()->CycleWindowLinear(direction); 58 ash::Shell::GetInstance()->launcher()->CycleWindowLinear(direction);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 171 }
165 172
166 bool HandlePrintWindowHierarchy() { 173 bool HandlePrintWindowHierarchy() {
167 VLOG(1) << "Window hierarchy:"; 174 VLOG(1) << "Window hierarchy:";
168 aura::Window* container = ash::Shell::GetInstance()->GetContainer( 175 aura::Window* container = ash::Shell::GetInstance()->GetContainer(
169 ash::internal::kShellWindowId_DefaultContainer); 176 ash::internal::kShellWindowId_DefaultContainer);
170 PrintWindowHierarchy(container, 0); 177 PrintWindowHierarchy(container, 0);
171 return true; 178 return true;
172 } 179 }
173 180
181 // Mafnify the screen
sky 2012/06/11 16:19:14 Magnify the screen.
yoshiki 2012/06/19 17:56:16 Done.
182 bool HandleMagnifyScreen(int delta_index) {
183 static int scale_index = 0;
184 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.
185
186 ash::Shell::GetInstance()->magnification_controller()->
187 SetScale(std::pow(kMagnificationFactor, scale_index), true);
sky 2012/06/11 16:19:14 indent 4
yoshiki 2012/06/19 17:56:16 Done.
188
189 return true;
190 }
191
174 #endif 192 #endif
175 193
176 } // namespace 194 } // namespace
177 195
178 namespace ash { 196 namespace ash {
179 197
180 //////////////////////////////////////////////////////////////////////////////// 198 ////////////////////////////////////////////////////////////////////////////////
181 // AcceleratorController, public: 199 // AcceleratorController, public:
182 200
183 AcceleratorController::AcceleratorController() 201 AcceleratorController::AcceleratorController()
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 return HandlePrintWindowHierarchy(); 481 return HandlePrintWindowHierarchy();
464 case MONITOR_ADD_REMOVE: 482 case MONITOR_ADD_REMOVE:
465 internal::MultiMonitorManager::AddRemoveMonitor(); 483 internal::MultiMonitorManager::AddRemoveMonitor();
466 return true; 484 return true;
467 case MONITOR_CYCLE: 485 case MONITOR_CYCLE:
468 internal::MultiMonitorManager::CycleMonitor(); 486 internal::MultiMonitorManager::CycleMonitor();
469 return true; 487 return true;
470 case MONITOR_TOGGLE_SCALE: 488 case MONITOR_TOGGLE_SCALE:
471 internal::MultiMonitorManager::ToggleMonitorScale(); 489 internal::MultiMonitorManager::ToggleMonitorScale();
472 return true; 490 return true;
491 case MAGNIFY_SCREEN_ZOOM_IN:
492 return HandleMagnifyScreen(1);
493 case MAGNIFY_SCREEN_ZOOM_OUT:
494 return HandleMagnifyScreen(-1);
473 #endif 495 #endif
474 default: 496 default:
475 NOTREACHED() << "Unhandled action " << it->second; 497 NOTREACHED() << "Unhandled action " << it->second;
476 } 498 }
477 return false; 499 return false;
478 } 500 }
479 501
480 void AcceleratorController::SwitchToWindow(int window) { 502 void AcceleratorController::SwitchToWindow(int window) {
481 const LauncherItems& items = 503 const LauncherItems& items =
482 Shell::GetInstance()->launcher()->model()->items(); 504 Shell::GetInstance()->launcher()->model()->items();
(...skipping 20 matching lines...) Expand all
503 // Then set this one as active. 525 // Then set this one as active.
504 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); 526 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index);
505 } 527 }
506 } 528 }
507 529
508 bool AcceleratorController::CanHandleAccelerators() const { 530 bool AcceleratorController::CanHandleAccelerators() const {
509 return true; 531 return true;
510 } 532 }
511 533
512 } // namespace ash 534 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | ash/magnifier/magnification_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698