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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: sky'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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP2) 395 if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP2)
396 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); 396 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4"));
397 accelerators::ToggleFullscreen(); 397 accelerators::ToggleFullscreen();
398 } 398 }
399 399
400 void HandleToggleOverview() { 400 void HandleToggleOverview() {
401 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5")); 401 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5"));
402 WmShell::Get()->window_selector_controller()->ToggleOverview(); 402 WmShell::Get()->window_selector_controller()->ToggleOverview();
403 } 403 }
404 404
405 bool CanHandleWindowSnapOrDock() { 405 bool CanHandleWindowSnap() {
406 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); 406 WmWindow* active_window = WmShell::Get()->GetActiveWindow();
407 if (!active_window) 407 if (!active_window)
408 return false; 408 return false;
409 wm::WindowState* window_state = active_window->GetWindowState(); 409 wm::WindowState* window_state = active_window->GetWindowState();
410 // Disable window snapping shortcut key for full screen window due to 410 // Disable window snapping shortcut key for full screen window due to
411 // http://crbug.com/135487. 411 // http://crbug.com/135487.
412 return (window_state && window_state->IsUserPositionable() && 412 return (window_state && window_state->IsUserPositionable() &&
413 !window_state->IsFullscreen()); 413 !window_state->IsFullscreen());
414 } 414 }
415 415
416 void HandleWindowSnapOrDock(AcceleratorAction action) { 416 void HandleWindowSnap(AcceleratorAction action) {
417 if (action == WINDOW_CYCLE_SNAP_DOCK_LEFT) 417 if (action == WINDOW_CYCLE_SNAP_LEFT)
418 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left")); 418 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left"));
419 else 419 else
420 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right")); 420 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right"));
421 421
422 const wm::WMEvent event(action == WINDOW_CYCLE_SNAP_DOCK_LEFT 422 const wm::WMEvent event(action == WINDOW_CYCLE_SNAP_LEFT
423 ? wm::WM_EVENT_CYCLE_SNAP_DOCK_LEFT 423 ? wm::WM_EVENT_CYCLE_SNAP_LEFT
424 : wm::WM_EVENT_CYCLE_SNAP_DOCK_RIGHT); 424 : wm::WM_EVENT_CYCLE_SNAP_RIGHT);
425 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); 425 WmWindow* active_window = WmShell::Get()->GetActiveWindow();
426 DCHECK(active_window); 426 DCHECK(active_window);
427 active_window->GetWindowState()->OnWMEvent(&event); 427 active_window->GetWindowState()->OnWMEvent(&event);
428 } 428 }
429 429
430 void HandleWindowMinimize() { 430 void HandleWindowMinimize() {
431 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Minimized_Minus")); 431 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Minimized_Minus"));
432 accelerators::ToggleMinimized(); 432 accelerators::ToggleMinimized();
433 } 433 }
434 434
435 bool CanHandlePositionCenter() { 435 bool CanHandlePositionCenter() {
436 // Docked windows do not support centering. 436 return WmShell::Get()->GetActiveWindow() != nullptr;
437 WmWindow* active_window = WmShell::Get()->GetActiveWindow();
438 return (active_window && !active_window->GetWindowState()->IsDocked());
439 } 437 }
440 438
441 void HandlePositionCenter() { 439 void HandlePositionCenter() {
442 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); 440 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center"));
443 wm::CenterWindow(WmShell::Get()->GetActiveWindow()); 441 wm::CenterWindow(WmShell::Get()->GetActiveWindow());
444 } 442 }
445 443
446 void HandleShowImeMenuBubble() { 444 void HandleShowImeMenuBubble() {
447 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble")); 445 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble"));
448 446
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 return CanHandleShowStylusTools(); 907 return CanHandleShowStylusTools();
910 case SWITCH_IME: 908 case SWITCH_IME:
911 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator); 909 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator);
912 case SWITCH_TO_PREVIOUS_USER: 910 case SWITCH_TO_PREVIOUS_USER:
913 case SWITCH_TO_NEXT_USER: 911 case SWITCH_TO_NEXT_USER:
914 return CanHandleCycleUser(); 912 return CanHandleCycleUser();
915 case TOGGLE_APP_LIST: 913 case TOGGLE_APP_LIST:
916 return CanHandleToggleAppList(accelerator, previous_accelerator); 914 return CanHandleToggleAppList(accelerator, previous_accelerator);
917 case TOGGLE_CAPS_LOCK: 915 case TOGGLE_CAPS_LOCK:
918 return CanHandleToggleCapsLock(accelerator, previous_accelerator); 916 return CanHandleToggleCapsLock(accelerator, previous_accelerator);
919 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 917 case WINDOW_CYCLE_SNAP_LEFT:
920 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 918 case WINDOW_CYCLE_SNAP_RIGHT:
921 return CanHandleWindowSnapOrDock(); 919 return CanHandleWindowSnap();
922 case WINDOW_POSITION_CENTER: 920 case WINDOW_POSITION_CENTER:
923 return CanHandlePositionCenter(); 921 return CanHandlePositionCenter();
924 922
925 // The following are always enabled. 923 // The following are always enabled.
926 case BRIGHTNESS_DOWN: 924 case BRIGHTNESS_DOWN:
927 case BRIGHTNESS_UP: 925 case BRIGHTNESS_UP:
928 case EXIT: 926 case EXIT:
929 case FOCUS_NEXT_PANE: 927 case FOCUS_NEXT_PANE:
930 case FOCUS_PREVIOUS_PANE: 928 case FOCUS_PREVIOUS_PANE:
931 case FOCUS_SHELF: 929 case FOCUS_SHELF:
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 break; 1179 break;
1182 case VOLUME_DOWN: 1180 case VOLUME_DOWN:
1183 HandleVolumeDown(volume_controller_.get(), accelerator); 1181 HandleVolumeDown(volume_controller_.get(), accelerator);
1184 break; 1182 break;
1185 case VOLUME_MUTE: 1183 case VOLUME_MUTE:
1186 HandleVolumeMute(volume_controller_.get(), accelerator); 1184 HandleVolumeMute(volume_controller_.get(), accelerator);
1187 break; 1185 break;
1188 case VOLUME_UP: 1186 case VOLUME_UP:
1189 HandleVolumeUp(volume_controller_.get(), accelerator); 1187 HandleVolumeUp(volume_controller_.get(), accelerator);
1190 break; 1188 break;
1191 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 1189 case WINDOW_CYCLE_SNAP_LEFT:
1192 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 1190 case WINDOW_CYCLE_SNAP_RIGHT:
1193 HandleWindowSnapOrDock(action); 1191 HandleWindowSnap(action);
1194 break; 1192 break;
1195 case WINDOW_MINIMIZE: 1193 case WINDOW_MINIMIZE:
1196 HandleWindowMinimize(); 1194 HandleWindowMinimize();
1197 break; 1195 break;
1198 case WINDOW_POSITION_CENTER: 1196 case WINDOW_POSITION_CENTER:
1199 HandlePositionCenter(); 1197 HandlePositionCenter();
1200 break; 1198 break;
1201 default: 1199 default:
1202 // Temporary until mash transition complete. Needed as some actions 1200 // Temporary until mash transition complete. Needed as some actions
1203 // don't yet work with mash. 1201 // don't yet work with mash.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 data->uma_histogram_name, data->notification_message_id, 1285 data->uma_histogram_name, data->notification_message_id,
1288 data->old_shortcut_id, data->new_shortcut_id); 1286 data->old_shortcut_id, data->new_shortcut_id);
1289 1287
1290 if (!data->deprecated_enabled) 1288 if (!data->deprecated_enabled)
1291 return AcceleratorProcessingStatus::STOP; 1289 return AcceleratorProcessingStatus::STOP;
1292 1290
1293 return AcceleratorProcessingStatus::PROCEED; 1291 return AcceleratorProcessingStatus::PROCEED;
1294 } 1292 }
1295 1293
1296 } // namespace ash 1294 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698