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 <iostream> | 9 #include <iostream> |
10 #include <string> | 10 #include <string> |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 return true; | 834 return true; |
835 case LAUNCH_APP_7: | 835 case LAUNCH_APP_7: |
836 Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(7); | 836 Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(7); |
837 return true; | 837 return true; |
838 case LAUNCH_LAST_APP: | 838 case LAUNCH_LAST_APP: |
839 Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(-1); | 839 Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(-1); |
840 return true; | 840 return true; |
841 case WINDOW_SNAP_LEFT: | 841 case WINDOW_SNAP_LEFT: |
842 case WINDOW_SNAP_RIGHT: { | 842 case WINDOW_SNAP_RIGHT: { |
843 wm::WindowState* window_state = wm::GetActiveWindowState(); | 843 wm::WindowState* window_state = wm::GetActiveWindowState(); |
844 // Disable window docking shortcut key for full screen window due to | 844 // Disable window snapping shortcut key for full screen window due to |
845 // http://crbug.com/135487. | 845 // http://crbug.com/135487. |
846 if (!window_state || | 846 if (!window_state || |
847 window_state->window()->type() != aura::client::WINDOW_TYPE_NORMAL || | 847 window_state->window()->type() != aura::client::WINDOW_TYPE_NORMAL || |
848 window_state->IsFullscreen()) { | 848 window_state->IsFullscreen()) { |
849 break; | 849 break; |
850 } | 850 } |
851 | 851 |
852 internal::SnapSizer::SnapWindow(window_state, | 852 internal::SnapSizer::SnapWindow(window_state, |
853 action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : | 853 action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : |
854 internal::SnapSizer::RIGHT_EDGE); | 854 internal::SnapSizer::RIGHT_EDGE); |
855 return true; | 855 return true; |
856 } | 856 } |
857 case WINDOW_MINIMIZE: | 857 case WINDOW_MINIMIZE: |
858 return accelerators::ToggleMinimized(); | 858 return accelerators::ToggleMinimized(); |
859 case TOGGLE_FULLSCREEN: { | 859 case TOGGLE_FULLSCREEN: { |
860 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP2) { | 860 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP2) { |
861 shell->delegate()->RecordUserMetricsAction( | 861 shell->delegate()->RecordUserMetricsAction( |
862 UMA_ACCEL_FULLSCREEN_F4); | 862 UMA_ACCEL_FULLSCREEN_F4); |
863 } | 863 } |
864 accelerators::ToggleFullscreen(); | 864 accelerators::ToggleFullscreen(); |
865 return true; | 865 return true; |
866 } | 866 } |
867 case TOGGLE_MAXIMIZED: { | 867 case TOGGLE_MAXIMIZED: { |
868 accelerators::ToggleMaximized(); | 868 accelerators::ToggleMaximized(); |
869 return true; | 869 return true; |
870 } | 870 } |
871 case WINDOW_POSITION_CENTER: { | 871 case WINDOW_POSITION_CENTER: { |
872 aura::Window* window = wm::GetActiveWindow(); | 872 aura::Window* window = wm::GetActiveWindow(); |
873 if (window) { | 873 // Centering a window does not maintain state and state change |
| 874 // notifications are not sent. Disable centering for docked windows. |
| 875 if (window && !wm::GetWindowState(window)->IsDocked()) { |
| 876 wm::GetWindowState(window)->SetWindowShowTypeUnsnapped(); |
874 wm::CenterWindow(window); | 877 wm::CenterWindow(window); |
875 return true; | 878 return true; |
876 } | 879 } |
877 break; | 880 break; |
878 } | 881 } |
879 case SCALE_UI_UP: | 882 case SCALE_UI_UP: |
880 return HandleScaleUI(true /* up */); | 883 return HandleScaleUI(true /* up */); |
881 case SCALE_UI_DOWN: | 884 case SCALE_UI_DOWN: |
882 return HandleScaleUI(false /* down */); | 885 return HandleScaleUI(false /* down */); |
883 case SCALE_UI_RESET: | 886 case SCALE_UI_RESET: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 keyboard_brightness_control_delegate) { | 998 keyboard_brightness_control_delegate) { |
996 keyboard_brightness_control_delegate_ = | 999 keyboard_brightness_control_delegate_ = |
997 keyboard_brightness_control_delegate.Pass(); | 1000 keyboard_brightness_control_delegate.Pass(); |
998 } | 1001 } |
999 | 1002 |
1000 bool AcceleratorController::CanHandleAccelerators() const { | 1003 bool AcceleratorController::CanHandleAccelerators() const { |
1001 return true; | 1004 return true; |
1002 } | 1005 } |
1003 | 1006 |
1004 } // namespace ash | 1007 } // namespace ash |
OLD | NEW |