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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: varkha's comments Created 3 years, 9 months 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
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/common/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/accelerators/accelerator_commands.h" 9 #include "ash/common/accelerators/accelerator_commands.h"
10 #include "ash/common/accelerators/accelerator_controller_delegate.h" 10 #include "ash/common/accelerators/accelerator_controller_delegate.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP2) 279 if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP2)
280 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); 280 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4"));
281 accelerators::ToggleFullscreen(); 281 accelerators::ToggleFullscreen();
282 } 282 }
283 283
284 void HandleToggleOverview() { 284 void HandleToggleOverview() {
285 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5")); 285 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5"));
286 WmShell::Get()->window_selector_controller()->ToggleOverview(); 286 WmShell::Get()->window_selector_controller()->ToggleOverview();
287 } 287 }
288 288
289 bool CanHandleWindowSnapOrDock() { 289 bool CanHandleWindowSnap() {
290 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); 290 WmWindow* active_window = WmShell::Get()->GetActiveWindow();
291 if (!active_window) 291 if (!active_window)
292 return false; 292 return false;
293 wm::WindowState* window_state = active_window->GetWindowState(); 293 wm::WindowState* window_state = active_window->GetWindowState();
294 // Disable window snapping shortcut key for full screen window due to 294 // Disable window snapping shortcut key for full screen window due to
295 // http://crbug.com/135487. 295 // http://crbug.com/135487.
296 return (window_state && window_state->IsUserPositionable() && 296 return (window_state && window_state->IsUserPositionable() &&
297 !window_state->IsFullscreen()); 297 !window_state->IsFullscreen());
298 } 298 }
299 299
300 void HandleWindowSnapOrDock(AcceleratorAction action) { 300 void HandleWindowSnap(AcceleratorAction action) {
301 if (action == WINDOW_CYCLE_SNAP_DOCK_LEFT) 301 if (action == WINDOW_CYCLE_SNAP_LEFT)
302 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left")); 302 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left"));
303 else 303 else
304 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right")); 304 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right"));
305 305
306 const wm::WMEvent event(action == WINDOW_CYCLE_SNAP_DOCK_LEFT 306 const wm::WMEvent event(action == WINDOW_CYCLE_SNAP_LEFT
307 ? wm::WM_EVENT_CYCLE_SNAP_DOCK_LEFT 307 ? wm::WM_EVENT_CYCLE_SNAP_LEFT
308 : wm::WM_EVENT_CYCLE_SNAP_DOCK_RIGHT); 308 : wm::WM_EVENT_CYCLE_SNAP_RIGHT);
309 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); 309 WmWindow* active_window = WmShell::Get()->GetActiveWindow();
310 DCHECK(active_window); 310 DCHECK(active_window);
311 active_window->GetWindowState()->OnWMEvent(&event); 311 active_window->GetWindowState()->OnWMEvent(&event);
312 } 312 }
313 313
314 void HandleWindowMinimize() { 314 void HandleWindowMinimize() {
315 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Minimized_Minus")); 315 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Minimized_Minus"));
316 accelerators::ToggleMinimized(); 316 accelerators::ToggleMinimized();
317 } 317 }
318 318
319 bool CanHandlePositionCenter() { 319 bool CanHandlePositionCenter() {
320 // Docked windows do not support centering. 320 return !!WmShell::Get()->GetActiveWindow();
321 WmWindow* active_window = WmShell::Get()->GetActiveWindow();
322 return (active_window && !active_window->GetWindowState()->IsDocked());
323 } 321 }
324 322
325 void HandlePositionCenter() { 323 void HandlePositionCenter() {
326 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); 324 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center"));
327 wm::CenterWindow(WmShell::Get()->GetActiveWindow()); 325 wm::CenterWindow(WmShell::Get()->GetActiveWindow());
328 } 326 }
329 327
330 void HandleShowImeMenuBubble() { 328 void HandleShowImeMenuBubble() {
331 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble")); 329 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble"));
332 330
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 return CanHandleShowStylusTools(); 791 return CanHandleShowStylusTools();
794 case SWITCH_IME: 792 case SWITCH_IME:
795 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator); 793 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator);
796 case SWITCH_TO_PREVIOUS_USER: 794 case SWITCH_TO_PREVIOUS_USER:
797 case SWITCH_TO_NEXT_USER: 795 case SWITCH_TO_NEXT_USER:
798 return CanHandleCycleUser(); 796 return CanHandleCycleUser();
799 case TOGGLE_APP_LIST: 797 case TOGGLE_APP_LIST:
800 return CanHandleToggleAppList(accelerator, previous_accelerator); 798 return CanHandleToggleAppList(accelerator, previous_accelerator);
801 case TOGGLE_CAPS_LOCK: 799 case TOGGLE_CAPS_LOCK:
802 return CanHandleToggleCapsLock(accelerator, previous_accelerator); 800 return CanHandleToggleCapsLock(accelerator, previous_accelerator);
803 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 801 case WINDOW_CYCLE_SNAP_LEFT:
804 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 802 case WINDOW_CYCLE_SNAP_RIGHT:
805 return CanHandleWindowSnapOrDock(); 803 return CanHandleWindowSnap();
806 case WINDOW_POSITION_CENTER: 804 case WINDOW_POSITION_CENTER:
807 return CanHandlePositionCenter(); 805 return CanHandlePositionCenter();
808 806
809 // The following are always enabled. 807 // The following are always enabled.
810 case BRIGHTNESS_DOWN: 808 case BRIGHTNESS_DOWN:
811 case BRIGHTNESS_UP: 809 case BRIGHTNESS_UP:
812 case EXIT: 810 case EXIT:
813 case FOCUS_NEXT_PANE: 811 case FOCUS_NEXT_PANE:
814 case FOCUS_PREVIOUS_PANE: 812 case FOCUS_PREVIOUS_PANE:
815 case FOCUS_SHELF: 813 case FOCUS_SHELF:
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 break; 1055 break;
1058 case VOLUME_DOWN: 1056 case VOLUME_DOWN:
1059 HandleVolumeDown(volume_controller_.get(), accelerator); 1057 HandleVolumeDown(volume_controller_.get(), accelerator);
1060 break; 1058 break;
1061 case VOLUME_MUTE: 1059 case VOLUME_MUTE:
1062 HandleVolumeMute(volume_controller_.get(), accelerator); 1060 HandleVolumeMute(volume_controller_.get(), accelerator);
1063 break; 1061 break;
1064 case VOLUME_UP: 1062 case VOLUME_UP:
1065 HandleVolumeUp(volume_controller_.get(), accelerator); 1063 HandleVolumeUp(volume_controller_.get(), accelerator);
1066 break; 1064 break;
1067 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 1065 case WINDOW_CYCLE_SNAP_LEFT:
1068 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 1066 case WINDOW_CYCLE_SNAP_RIGHT:
1069 HandleWindowSnapOrDock(action); 1067 HandleWindowSnap(action);
1070 break; 1068 break;
1071 case WINDOW_MINIMIZE: 1069 case WINDOW_MINIMIZE:
1072 HandleWindowMinimize(); 1070 HandleWindowMinimize();
1073 break; 1071 break;
1074 case WINDOW_POSITION_CENTER: 1072 case WINDOW_POSITION_CENTER:
1075 HandlePositionCenter(); 1073 HandlePositionCenter();
1076 break; 1074 break;
1077 default: 1075 default:
1078 // Temporary until mash transition complete. Needed as some actions 1076 // Temporary until mash transition complete. Needed as some actions
1079 // don't yet work with mash. 1077 // don't yet work with mash.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 data->old_shortcut_id, data->new_shortcut_id); 1163 data->old_shortcut_id, data->new_shortcut_id);
1166 } 1164 }
1167 1165
1168 if (!data->deprecated_enabled) 1166 if (!data->deprecated_enabled)
1169 return AcceleratorProcessingStatus::STOP; 1167 return AcceleratorProcessingStatus::STOP;
1170 1168
1171 return AcceleratorProcessingStatus::PROCEED; 1169 return AcceleratorProcessingStatus::PROCEED;
1172 } 1170 }
1173 1171
1174 } // namespace ash 1172 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698