| 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/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/caps_lock_delegate.h" | 10 #include "ash/caps_lock_delegate.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_model.h" | 14 #include "ash/launcher/launcher_model.h" |
| 15 #include "ash/launcher/launcher_delegate.h" | 15 #include "ash/launcher/launcher_delegate.h" |
| 16 #include "ash/monitor/multi_monitor_manager.h" | 16 #include "ash/monitor/multi_monitor_manager.h" |
| 17 #include "ash/screenshot_delegate.h" | 17 #include "ash/screenshot_delegate.h" |
| 18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 19 #include "ash/shell_delegate.h" | 19 #include "ash/shell_delegate.h" |
| 20 #include "ash/shell_window_ids.h" | 20 #include "ash/shell_window_ids.h" |
| 21 #include "ash/system/brightness/brightness_control_delegate.h" | 21 #include "ash/system/brightness/brightness_control_delegate.h" |
| 22 #include "ash/system/tray/system_tray.h" | 22 #include "ash/system/tray/system_tray.h" |
| 23 #include "ash/volume_control_delegate.h" | 23 #include "ash/volume_control_delegate.h" |
| 24 #include "ash/wm/property_util.h" |
| 24 #include "ash/wm/window_cycle_controller.h" | 25 #include "ash/wm/window_cycle_controller.h" |
| 25 #include "ash/wm/window_util.h" | 26 #include "ash/wm/window_util.h" |
| 27 #include "ash/wm/workspace/snap_sizer.h" |
| 26 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| 27 #include "ui/aura/event.h" | 29 #include "ui/aura/event.h" |
| 28 #include "ui/aura/root_window.h" | 30 #include "ui/aura/root_window.h" |
| 29 #include "ui/base/accelerators/accelerator.h" | 31 #include "ui/base/accelerators/accelerator.h" |
| 30 #include "ui/base/accelerators/accelerator_manager.h" | 32 #include "ui/base/accelerators/accelerator_manager.h" |
| 31 #include "ui/gfx/compositor/debug_utils.h" | 33 #include "ui/gfx/compositor/debug_utils.h" |
| 32 #include "ui/gfx/compositor/layer.h" | 34 #include "ui/gfx/compositor/layer.h" |
| 33 #include "ui/gfx/compositor/layer_animation_sequence.h" | 35 #include "ui/gfx/compositor/layer_animation_sequence.h" |
| 34 #include "ui/gfx/compositor/layer_animator.h" | 36 #include "ui/gfx/compositor/layer_animator.h" |
| 35 #include "ui/gfx/compositor/screen_rotation.h" | 37 #include "ui/gfx/compositor/screen_rotation.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 return volume_control_delegate_->HandleVolumeDown(accelerator); | 383 return volume_control_delegate_->HandleVolumeDown(accelerator); |
| 382 break; | 384 break; |
| 383 case VOLUME_UP: | 385 case VOLUME_UP: |
| 384 if (volume_control_delegate_.get()) | 386 if (volume_control_delegate_.get()) |
| 385 return volume_control_delegate_->HandleVolumeUp(accelerator); | 387 return volume_control_delegate_->HandleVolumeUp(accelerator); |
| 386 break; | 388 break; |
| 387 case FOCUS_TRAY: | 389 case FOCUS_TRAY: |
| 388 if (shell->tray()) | 390 if (shell->tray()) |
| 389 return shell->focus_cycler()->FocusWidget(shell->tray()->GetWidget()); | 391 return shell->focus_cycler()->FocusWidget(shell->tray()->GetWidget()); |
| 390 break; | 392 break; |
| 393 case SNAP_WINDOW_LEFT: |
| 394 case SNAP_WINDOW_RIGHT: { |
| 395 aura::Window* window = wm::GetActiveWindow(); |
| 396 if (!window) |
| 397 break; |
| 398 internal::SnapSizer sizer(window, |
| 399 gfx::Point(), |
| 400 action == SNAP_WINDOW_LEFT ? internal::SnapSizer::LEFT_EDGE : |
| 401 internal::SnapSizer::RIGHT_EDGE, |
| 402 shell->GetGridSize()); |
| 403 window->SetBounds(sizer.target_bounds()); |
| 404 break; |
| 405 } |
| 391 case SHOW_OAK: | 406 case SHOW_OAK: |
| 392 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshEnableOak)) | 407 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshEnableOak)) |
| 393 oak::ShowOakWindow(); | 408 oak::ShowOakWindow(); |
| 394 break; | 409 break; |
| 395 case NEXT_IME: | 410 case NEXT_IME: |
| 396 if (ime_control_delegate_.get()) | 411 if (ime_control_delegate_.get()) |
| 397 return ime_control_delegate_->HandleNextIme(); | 412 return ime_control_delegate_->HandleNextIme(); |
| 398 break; | 413 break; |
| 399 case PREVIOUS_IME: | 414 case PREVIOUS_IME: |
| 400 if (ime_control_delegate_.get()) | 415 if (ime_control_delegate_.get()) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // Then set this one as active. | 498 // Then set this one as active. |
| 484 ActivateLauncherItem(found_index); | 499 ActivateLauncherItem(found_index); |
| 485 } | 500 } |
| 486 } | 501 } |
| 487 | 502 |
| 488 bool AcceleratorController::CanHandleAccelerators() const { | 503 bool AcceleratorController::CanHandleAccelerators() const { |
| 489 return true; | 504 return true; |
| 490 } | 505 } |
| 491 | 506 |
| 492 } // namespace ash | 507 } // namespace ash |
| OLD | NEW |