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

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

Issue 2886253002: mash: remove more shell/shelf WmWindow usage. (Closed)
Patch Set: Fix WmShelf::ForWindow. Created 3 years, 7 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
« no previous file with comments | « no previous file | ash/accelerators/exit_warning_handler.cc » ('j') | no next file with comments »
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 <utility> 7 #include <utility>
8 8
9 #include "ash/accelerators/accelerator_commands.h" 9 #include "ash/accelerators/accelerator_commands.h"
10 #include "ash/accelerators/accelerator_controller_delegate.h" 10 #include "ash/accelerators/accelerator_controller_delegate.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 case FocusCycler::BACKWARD: { 197 case FocusCycler::BACKWARD: {
198 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); 198 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane"));
199 break; 199 break;
200 } 200 }
201 } 201 }
202 Shell::Get()->focus_cycler()->RotateFocus(direction); 202 Shell::Get()->focus_cycler()->RotateFocus(direction);
203 } 203 }
204 204
205 void HandleFocusShelf() { 205 void HandleFocusShelf() {
206 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf")); 206 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf"));
207 // TODO(jamescook): Should this be GetWmRootWindowForNewWindows()? 207 // TODO(jamescook): Should this be GetRootWindowForNewWindows()?
208 WmShelf* shelf = WmShelf::ForWindow(ShellPort::Get()->GetPrimaryRootWindow()); 208 WmShelf* shelf = WmShelf::ForWindow(Shell::GetPrimaryRootWindow());
209 Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget()); 209 Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
210 } 210 }
211 211
212 void HandleLaunchAppN(int n) { 212 void HandleLaunchAppN(int n) {
213 base::RecordAction(UserMetricsAction("Accel_Launch_App")); 213 base::RecordAction(UserMetricsAction("Accel_Launch_App"));
214 WmShelf::LaunchShelfItem(n); 214 WmShelf::LaunchShelfItem(n);
215 } 215 }
216 216
217 void HandleLaunchLastApp() { 217 void HandleLaunchLastApp() {
218 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); 218 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App"));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 new ui::LayerAnimationSequence( 310 new ui::LayerAnimationSequence(
311 base::MakeUnique<WindowRotation>(360, active_window->layer()))); 311 base::MakeUnique<WindowRotation>(360, active_window->layer())));
312 } 312 }
313 313
314 void HandleShowKeyboardOverlay() { 314 void HandleShowKeyboardOverlay() {
315 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); 315 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay"));
316 Shell::Get()->new_window_controller()->ShowKeyboardOverlay(); 316 Shell::Get()->new_window_controller()->ShowKeyboardOverlay();
317 } 317 }
318 318
319 bool CanHandleShowMessageCenterBubble() { 319 bool CanHandleShowMessageCenterBubble() {
320 WmWindow* target_root = Shell::GetWmRootWindowForNewWindows(); 320 aura::Window* target_root = Shell::GetRootWindowForNewWindows();
321 StatusAreaWidget* status_area_widget = 321 StatusAreaWidget* status_area_widget =
322 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); 322 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
323 return status_area_widget && 323 return status_area_widget &&
324 status_area_widget->web_notification_tray()->visible(); 324 status_area_widget->web_notification_tray()->visible();
325 } 325 }
326 326
327 void HandleShowMessageCenterBubble() { 327 void HandleShowMessageCenterBubble() {
328 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); 328 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble"));
329 WmWindow* target_root = Shell::GetWmRootWindowForNewWindows(); 329 aura::Window* target_root = Shell::GetRootWindowForNewWindows();
330 StatusAreaWidget* status_area_widget = 330 StatusAreaWidget* status_area_widget =
331 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); 331 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget();
332 if (status_area_widget) { 332 if (status_area_widget) {
333 WebNotificationTray* notification_tray = 333 WebNotificationTray* notification_tray =
334 status_area_widget->web_notification_tray(); 334 status_area_widget->web_notification_tray();
335 if (notification_tray->visible()) 335 if (notification_tray->visible())
336 notification_tray->ShowMessageCenterBubble(); 336 notification_tray->ShowMessageCenterBubble();
337 } 337 }
338 } 338 }
339 339
340 void HandleShowSystemTrayBubble() { 340 void HandleShowSystemTrayBubble() {
341 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble")); 341 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble"));
342 WmWindow* target_root = Shell::GetWmRootWindowForNewWindows(); 342 aura::Window* target_root = Shell::GetRootWindowForNewWindows();
343 SystemTray* tray = target_root->GetRootWindowController()->GetSystemTray(); 343 SystemTray* tray = GetRootWindowController(target_root)->GetSystemTray();
344 if (!tray->HasSystemBubble()) { 344 if (!tray->HasSystemBubble()) {
345 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 345 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
346 tray->ActivateBubble(); 346 tray->ActivateBubble();
347 } 347 }
348 } 348 }
349 349
350 void HandleShowTaskManager() { 350 void HandleShowTaskManager() {
351 base::RecordAction(UserMetricsAction("Accel_Show_Task_Manager")); 351 base::RecordAction(UserMetricsAction("Accel_Show_Task_Manager"));
352 Shell::Get()->new_window_controller()->ShowTaskManager(); 352 Shell::Get()->new_window_controller()->ShowTaskManager();
353 } 353 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 438
439 void HandlePositionCenter() { 439 void HandlePositionCenter() {
440 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); 440 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center"));
441 wm::CenterWindow(WmWindow::Get(wm::GetActiveWindow())); 441 wm::CenterWindow(WmWindow::Get(wm::GetActiveWindow()));
442 } 442 }
443 443
444 void HandleShowImeMenuBubble() { 444 void HandleShowImeMenuBubble() {
445 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble")); 445 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble"));
446 446
447 StatusAreaWidget* status_area_widget = 447 StatusAreaWidget* status_area_widget =
448 WmShelf::ForWindow(ShellPort::Get()->GetPrimaryRootWindow()) 448 WmShelf::ForWindow(Shell::GetPrimaryRootWindow())->GetStatusAreaWidget();
449 ->GetStatusAreaWidget();
450 if (status_area_widget) { 449 if (status_area_widget) {
451 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray(); 450 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray();
452 if (ime_menu_tray && ime_menu_tray->visible() && 451 if (ime_menu_tray && ime_menu_tray->visible() &&
453 !ime_menu_tray->IsImeMenuBubbleShown()) { 452 !ime_menu_tray->IsImeMenuBubbleShown()) {
454 ime_menu_tray->ShowImeMenuBubble(); 453 ime_menu_tray->ShowImeMenuBubble();
455 } 454 }
456 } 455 }
457 } 456 }
458 457
459 void HandleCrosh() { 458 void HandleCrosh() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 return Shell::Get()->session_controller()->CanLockScreen(); 499 return Shell::Get()->session_controller()->CanLockScreen();
501 } 500 }
502 501
503 void HandleLock() { 502 void HandleLock() {
504 base::RecordAction(UserMetricsAction("Accel_LockScreen_L")); 503 base::RecordAction(UserMetricsAction("Accel_LockScreen_L"));
505 Shell::Get()->session_controller()->LockScreen(); 504 Shell::Get()->session_controller()->LockScreen();
506 } 505 }
507 506
508 void HandleShowStylusTools() { 507 void HandleShowStylusTools() {
509 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools")); 508 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools"));
510 Shell::GetWmRootWindowForNewWindows() 509 GetRootWindowController(Shell::GetRootWindowForNewWindows())
511 ->GetRootWindowController()
512 ->GetShelf() 510 ->GetShelf()
513 ->GetStatusAreaWidget() 511 ->GetStatusAreaWidget()
514 ->palette_tray() 512 ->palette_tray()
515 ->ShowPalette(); 513 ->ShowPalette();
516 } 514 }
517 515
518 bool CanHandleShowStylusTools() { 516 bool CanHandleShowStylusTools() {
519 return palette_utils::ShouldShowPalette(); 517 return palette_utils::ShouldShowPalette();
520 } 518 }
521 519
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 data->uma_histogram_name, data->notification_message_id, 1297 data->uma_histogram_name, data->notification_message_id,
1300 data->old_shortcut_id, data->new_shortcut_id); 1298 data->old_shortcut_id, data->new_shortcut_id);
1301 1299
1302 if (!data->deprecated_enabled) 1300 if (!data->deprecated_enabled)
1303 return AcceleratorProcessingStatus::STOP; 1301 return AcceleratorProcessingStatus::STOP;
1304 1302
1305 return AcceleratorProcessingStatus::PROCEED; 1303 return AcceleratorProcessingStatus::PROCEED;
1306 } 1304 }
1307 1305
1308 } // namespace ash 1306 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/exit_warning_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698