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 "ash/accelerators/accelerator_table.h" | 7 #include "ash/accelerators/accelerator_table.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/caps_lock_delegate.h" | 9 #include "ash/caps_lock_delegate.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| 11 #include "ash/focus_cycler.h" | 11 #include "ash/focus_cycler.h" |
| 12 #include "ash/ime_control_delegate.h" | 12 #include "ash/ime_control_delegate.h" |
| 13 #include "ash/launcher/launcher.h" | 13 #include "ash/launcher/launcher.h" |
| 14 #include "ash/launcher/launcher_delegate.h" | 14 #include "ash/launcher/launcher_delegate.h" |
| 15 #include "ash/launcher/launcher_model.h" | 15 #include "ash/launcher/launcher_model.h" |
| 16 #include "ash/magnifier/magnification_controller.h" | |
| 16 #include "ash/monitor/multi_monitor_manager.h" | 17 #include "ash/monitor/multi_monitor_manager.h" |
| 17 #include "ash/screenshot_delegate.h" | 18 #include "ash/screenshot_delegate.h" |
| 18 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 19 #include "ash/shell_delegate.h" | 20 #include "ash/shell_delegate.h" |
| 20 #include "ash/shell_window_ids.h" | 21 #include "ash/shell_window_ids.h" |
| 21 #include "ash/system/brightness/brightness_control_delegate.h" | 22 #include "ash/system/brightness/brightness_control_delegate.h" |
| 22 #include "ash/system/tray/system_tray.h" | 23 #include "ash/system/tray/system_tray.h" |
| 23 #include "ash/volume_control_delegate.h" | 24 #include "ash/volume_control_delegate.h" |
| 24 #include "ash/wm/property_util.h" | 25 #include "ash/wm/property_util.h" |
| 25 #include "ash/wm/window_cycle_controller.h" | 26 #include "ash/wm/window_cycle_controller.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 } | 165 } |
| 165 | 166 |
| 166 bool HandlePrintWindowHierarchy() { | 167 bool HandlePrintWindowHierarchy() { |
| 167 VLOG(1) << "Window hierarchy:"; | 168 VLOG(1) << "Window hierarchy:"; |
| 168 aura::Window* container = ash::Shell::GetInstance()->GetContainer( | 169 aura::Window* container = ash::Shell::GetInstance()->GetContainer( |
| 169 ash::internal::kShellWindowId_DefaultContainer); | 170 ash::internal::kShellWindowId_DefaultContainer); |
| 170 PrintWindowHierarchy(container, 0); | 171 PrintWindowHierarchy(container, 0); |
| 171 return true; | 172 return true; |
| 172 } | 173 } |
| 173 | 174 |
| 175 // Mafnify the screen | |
| 176 bool HandleMagnifyScreen(int delta_index) { | |
| 177 float scale = (delta_index > 0) ? 1.2f : 1.0f/1.2f; | |
|
sky
2012/06/07 18:05:50
Use constants (and spaces).
yoshiki
2012/06/08 22:27:45
Done.
| |
| 178 | |
| 179 float curren_scale = ash::Shell::GetInstance()-> | |
|
sky
2012/06/07 18:05:50
current_scale
yoshiki
2012/06/08 22:27:45
Done.
| |
| 180 magnification_controller()->GetScale(); | |
| 181 ash::Shell::GetInstance()-> | |
| 182 magnification_controller()->SetScale(curren_scale * scale, true); | |
|
sky
2012/06/07 18:05:50
Won't this lead to rounding errors? Wouldn't it be
yoshiki
2012/06/08 22:27:45
Done.
| |
| 183 | |
| 184 return true; | |
| 185 } | |
| 186 | |
| 174 #endif | 187 #endif |
| 175 | 188 |
| 176 } // namespace | 189 } // namespace |
| 177 | 190 |
| 178 namespace ash { | 191 namespace ash { |
| 179 | 192 |
| 180 //////////////////////////////////////////////////////////////////////////////// | 193 //////////////////////////////////////////////////////////////////////////////// |
| 181 // AcceleratorController, public: | 194 // AcceleratorController, public: |
| 182 | 195 |
| 183 AcceleratorController::AcceleratorController() | 196 AcceleratorController::AcceleratorController() |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 return HandlePrintWindowHierarchy(); | 476 return HandlePrintWindowHierarchy(); |
| 464 case MONITOR_ADD_REMOVE: | 477 case MONITOR_ADD_REMOVE: |
| 465 internal::MultiMonitorManager::AddRemoveMonitor(); | 478 internal::MultiMonitorManager::AddRemoveMonitor(); |
| 466 return true; | 479 return true; |
| 467 case MONITOR_CYCLE: | 480 case MONITOR_CYCLE: |
| 468 internal::MultiMonitorManager::CycleMonitor(); | 481 internal::MultiMonitorManager::CycleMonitor(); |
| 469 return true; | 482 return true; |
| 470 case MONITOR_TOGGLE_SCALE: | 483 case MONITOR_TOGGLE_SCALE: |
| 471 internal::MultiMonitorManager::ToggleMonitorScale(); | 484 internal::MultiMonitorManager::ToggleMonitorScale(); |
| 472 return true; | 485 return true; |
| 486 case MAGNIFY_SCREEN_ZOOM_IN: | |
| 487 return HandleMagnifyScreen(1); | |
| 488 case MAGNIFY_SCREEN_ZOOM_OUT: | |
| 489 return HandleMagnifyScreen(-1); | |
| 473 #endif | 490 #endif |
| 474 default: | 491 default: |
| 475 NOTREACHED() << "Unhandled action " << it->second; | 492 NOTREACHED() << "Unhandled action " << it->second; |
| 476 } | 493 } |
| 477 return false; | 494 return false; |
| 478 } | 495 } |
| 479 | 496 |
| 480 void AcceleratorController::SwitchToWindow(int window) { | 497 void AcceleratorController::SwitchToWindow(int window) { |
| 481 const LauncherItems& items = | 498 const LauncherItems& items = |
| 482 Shell::GetInstance()->launcher()->model()->items(); | 499 Shell::GetInstance()->launcher()->model()->items(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 503 // Then set this one as active. | 520 // Then set this one as active. |
| 504 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 521 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
| 505 } | 522 } |
| 506 } | 523 } |
| 507 | 524 |
| 508 bool AcceleratorController::CanHandleAccelerators() const { | 525 bool AcceleratorController::CanHandleAccelerators() const { |
| 509 return true; | 526 return true; |
| 510 } | 527 } |
| 511 | 528 |
| 512 } // namespace ash | 529 } // namespace ash |
| OLD | NEW |