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

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

Issue 2787363002: Moves couple of WmShell methods to standalone functions (Closed)
Patch Set: feedback and fix applist Created 3 years, 8 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4")); 399 base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4"));
400 accelerators::ToggleFullscreen(); 400 accelerators::ToggleFullscreen();
401 } 401 }
402 402
403 void HandleToggleOverview() { 403 void HandleToggleOverview() {
404 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5")); 404 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5"));
405 Shell::Get()->window_selector_controller()->ToggleOverview(); 405 Shell::Get()->window_selector_controller()->ToggleOverview();
406 } 406 }
407 407
408 bool CanHandleWindowSnap() { 408 bool CanHandleWindowSnap() {
409 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); 409 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow());
410 if (!active_window) 410 if (!active_window)
411 return false; 411 return false;
412 wm::WindowState* window_state = active_window->GetWindowState(); 412 wm::WindowState* window_state = active_window->GetWindowState();
413 // Disable window snapping shortcut key for full screen window due to 413 // Disable window snapping shortcut key for full screen window due to
414 // http://crbug.com/135487. 414 // http://crbug.com/135487.
415 return (window_state && window_state->IsUserPositionable() && 415 return (window_state && window_state->IsUserPositionable() &&
416 !window_state->IsFullscreen()); 416 !window_state->IsFullscreen());
417 } 417 }
418 418
419 void HandleWindowSnap(AcceleratorAction action) { 419 void HandleWindowSnap(AcceleratorAction action) {
420 if (action == WINDOW_CYCLE_SNAP_LEFT) 420 if (action == WINDOW_CYCLE_SNAP_LEFT)
421 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left")); 421 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Left"));
422 else 422 else
423 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right")); 423 base::RecordAction(UserMetricsAction("Accel_Window_Snap_Right"));
424 424
425 const wm::WMEvent event(action == WINDOW_CYCLE_SNAP_LEFT 425 const wm::WMEvent event(action == WINDOW_CYCLE_SNAP_LEFT
426 ? wm::WM_EVENT_CYCLE_SNAP_LEFT 426 ? wm::WM_EVENT_CYCLE_SNAP_LEFT
427 : wm::WM_EVENT_CYCLE_SNAP_RIGHT); 427 : wm::WM_EVENT_CYCLE_SNAP_RIGHT);
428 WmWindow* active_window = WmShell::Get()->GetActiveWindow(); 428 WmWindow* active_window = WmWindow::Get(wm::GetActiveWindow());
429 DCHECK(active_window); 429 DCHECK(active_window);
430 active_window->GetWindowState()->OnWMEvent(&event); 430 active_window->GetWindowState()->OnWMEvent(&event);
431 } 431 }
432 432
433 void HandleWindowMinimize() { 433 void HandleWindowMinimize() {
434 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Minimized_Minus")); 434 base::RecordAction(base::UserMetricsAction("Accel_Toggle_Minimized_Minus"));
435 accelerators::ToggleMinimized(); 435 accelerators::ToggleMinimized();
436 } 436 }
437 437
438 bool CanHandlePositionCenter() { 438 bool CanHandlePositionCenter() {
439 return WmShell::Get()->GetActiveWindow() != nullptr; 439 return wm::GetActiveWindow() != nullptr;
440 } 440 }
441 441
442 void HandlePositionCenter() { 442 void HandlePositionCenter() {
443 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); 443 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center"));
444 wm::CenterWindow(WmShell::Get()->GetActiveWindow()); 444 wm::CenterWindow(WmWindow::Get(wm::GetActiveWindow()));
445 } 445 }
446 446
447 void HandleShowImeMenuBubble() { 447 void HandleShowImeMenuBubble() {
448 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble")); 448 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble"));
449 449
450 StatusAreaWidget* status_area_widget = 450 StatusAreaWidget* status_area_widget =
451 WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()) 451 WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow())
452 ->GetStatusAreaWidget(); 452 ->GetStatusAreaWidget();
453 if (status_area_widget) { 453 if (status_area_widget) {
454 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray(); 454 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray();
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 data->uma_histogram_name, data->notification_message_id, 1297 data->uma_histogram_name, data->notification_message_id,
1298 data->old_shortcut_id, data->new_shortcut_id); 1298 data->old_shortcut_id, data->new_shortcut_id);
1299 1299
1300 if (!data->deprecated_enabled) 1300 if (!data->deprecated_enabled)
1301 return AcceleratorProcessingStatus::STOP; 1301 return AcceleratorProcessingStatus::STOP;
1302 1302
1303 return AcceleratorProcessingStatus::PROCEED; 1303 return AcceleratorProcessingStatus::PROCEED;
1304 } 1304 }
1305 1305
1306 } // namespace ash 1306 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/accelerators/accelerator_commands.cc ('k') | ash/common/accelerators/debug_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698