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/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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 break; | 447 break; |
| 446 case SELECT_WIN_6: | 448 case SELECT_WIN_6: |
| 447 SwitchToWindow(6); | 449 SwitchToWindow(6); |
| 448 break; | 450 break; |
| 449 case SELECT_WIN_7: | 451 case SELECT_WIN_7: |
| 450 SwitchToWindow(7); | 452 SwitchToWindow(7); |
| 451 break; | 453 break; |
| 452 case SELECT_LAST_WIN: | 454 case SELECT_LAST_WIN: |
| 453 SwitchToWindow(-1); | 455 SwitchToWindow(-1); |
| 454 break; | 456 break; |
| 457 case WINDOW_SNAP_LEFT: | |
| 458 case WINDOW_SNAP_RIGHT: { | |
| 459 aura::Window* window = wm::GetActiveWindow(); | |
| 460 if (!window) | |
| 461 break; | |
| 462 internal::SnapSizer sizer(window, | |
|
sky
2012/04/25 17:26:01
Can you make it so that this iterates over the pos
sadrul
2012/04/25 18:05:34
ooo, nice! Done.
| |
| 463 gfx::Point(), | |
| 464 action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : | |
| 465 internal::SnapSizer::RIGHT_EDGE, | |
| 466 shell->GetGridSize()); | |
| 467 window->SetBounds(sizer.target_bounds()); | |
| 468 break; | |
| 469 } | |
| 470 case WINDOW_MINIMIZE: { | |
| 471 aura::Window* window = wm::GetActiveWindow(); | |
| 472 if (window) | |
| 473 wm::MinimizeWindow(window); | |
| 474 break; | |
| 475 } | |
| 476 case WINDOW_MAXIMIZE_RESTORE: { | |
| 477 aura::Window* window = wm::GetActiveWindow(); | |
| 478 if (window) { | |
| 479 if (wm::IsWindowMaximized(window)) | |
| 480 wm::RestoreWindow(window); | |
| 481 else | |
| 482 wm::MaximizeWindow(window); | |
| 483 } | |
| 484 break; | |
| 485 } | |
| 486 case WINDOW_POSITION_CENTER: { | |
| 487 aura::Window* window = wm::GetActiveWindow(); | |
| 488 if (window) | |
| 489 wm::CenterWindow(window); | |
| 490 break; | |
| 491 } | |
| 455 case ROTATE_WINDOWS: | 492 case ROTATE_WINDOWS: |
| 456 return HandleRotateWindows(); | 493 return HandleRotateWindows(); |
| 457 #if !defined(NDEBUG) | 494 #if !defined(NDEBUG) |
| 458 case ROTATE_SCREEN: | 495 case ROTATE_SCREEN: |
| 459 return HandleRotateScreen(); | 496 return HandleRotateScreen(); |
| 460 case TOGGLE_DESKTOP_BACKGROUND_MODE: | 497 case TOGGLE_DESKTOP_BACKGROUND_MODE: |
| 461 return HandleToggleDesktopBackgroundMode(); | 498 return HandleToggleDesktopBackgroundMode(); |
| 462 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: | 499 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: |
| 463 return HandleToggleRootWindowFullScreen(); | 500 return HandleToggleRootWindowFullScreen(); |
| 464 case PRINT_LAYER_HIERARCHY: | 501 case PRINT_LAYER_HIERARCHY: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 // Then set this one as active. | 541 // Then set this one as active. |
| 505 ActivateLauncherItem(found_index); | 542 ActivateLauncherItem(found_index); |
| 506 } | 543 } |
| 507 } | 544 } |
| 508 | 545 |
| 509 bool AcceleratorController::CanHandleAccelerators() const { | 546 bool AcceleratorController::CanHandleAccelerators() const { |
| 510 return true; | 547 return true; |
| 511 } | 548 } |
| 512 | 549 |
| 513 } // namespace ash | 550 } // namespace ash |
| OLD | NEW |