Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 79023009: Avoids centering docked windows, Unsnaps when centering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoids centering docked windows, Unsnaps when centering. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/wm/window_util.cc » ('j') | ash/wm/window_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_util.cc » ('j') | ash/wm/window_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698