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