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

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

Issue 2304443002: ash: Move ShelfWidget ownership to WmShelf and refactor access to it (Closed)
Patch Set: review comments Created 4 years, 3 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/aura/wm_root_window_controller_aura.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_delegate_aura.h" 5 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "ash/accelerators/accelerator_commands_aura.h" 12 #include "ash/accelerators/accelerator_commands_aura.h"
13 #include "ash/common/accelerators/debug_commands.h" 13 #include "ash/common/accelerators/debug_commands.h"
14 #include "ash/common/accessibility_types.h" 14 #include "ash/common/accessibility_types.h"
15 #include "ash/common/ash_switches.h" 15 #include "ash/common/ash_switches.h"
16 #include "ash/common/gpu_support.h" 16 #include "ash/common/gpu_support.h"
17 #include "ash/common/session/session_state_delegate.h" 17 #include "ash/common/session/session_state_delegate.h"
18 #include "ash/common/shelf/shelf_widget.h"
19 #include "ash/common/shelf/wm_shelf.h" 18 #include "ash/common/shelf/wm_shelf.h"
20 #include "ash/common/shell_delegate.h" 19 #include "ash/common/shell_delegate.h"
21 #include "ash/common/shell_window_ids.h" 20 #include "ash/common/shell_window_ids.h"
22 #include "ash/common/system/status_area_widget.h"
23 #include "ash/common/system/system_notifier.h" 21 #include "ash/common/system/system_notifier.h"
24 #include "ash/common/system/tray/system_tray.h" 22 #include "ash/common/system/tray/system_tray.h"
25 #include "ash/common/system/web_notification/web_notification_tray.h"
26 #include "ash/common/wallpaper/wallpaper_delegate.h" 23 #include "ash/common/wallpaper/wallpaper_delegate.h"
27 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 24 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
28 #include "ash/common/wm/window_state.h" 25 #include "ash/common/wm/window_state.h"
29 #include "ash/common/wm/wm_event.h" 26 #include "ash/common/wm/wm_event.h"
30 #include "ash/common/wm_shell.h" 27 #include "ash/common/wm_shell.h"
31 #include "ash/debug.h" 28 #include "ash/debug.h"
32 #include "ash/display/display_manager.h" 29 #include "ash/display/display_manager.h"
33 #include "ash/display/window_tree_host_manager.h" 30 #include "ash/display/window_tree_host_manager.h"
34 #include "ash/host/ash_window_tree_host.h" 31 #include "ash/host/ash_window_tree_host.h"
35 #include "ash/magnifier/magnification_controller.h" 32 #include "ash/magnifier/magnification_controller.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // right now, queue this animation so when it starts it picks up a neutral 191 // right now, queue this animation so when it starts it picks up a neutral
195 // rotation and position. Use replace so we only enqueue one at a time. 192 // rotation and position. Use replace so we only enqueue one at a time.
196 active_window->layer()->GetAnimator()->set_preemption_strategy( 193 active_window->layer()->GetAnimator()->set_preemption_strategy(
197 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 194 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
198 active_window->layer()->GetAnimator()->StartAnimation( 195 active_window->layer()->GetAnimator()->StartAnimation(
199 new ui::LayerAnimationSequence( 196 new ui::LayerAnimationSequence(
200 new WindowRotation(360, active_window->layer()))); 197 new WindowRotation(360, active_window->layer())));
201 } 198 }
202 } 199 }
203 200
204 bool CanHandleShowMessageCenterBubble() {
205 RootWindowController* controller =
206 RootWindowController::ForTargetRootWindow();
207 StatusAreaWidget* status_area_widget =
208 controller->shelf_widget()->status_area_widget();
209 return status_area_widget &&
210 status_area_widget->web_notification_tray()->visible();
211 }
212
213 void HandleShowMessageCenterBubble() {
214 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble"));
215 RootWindowController* controller =
216 RootWindowController::ForTargetRootWindow();
217 StatusAreaWidget* status_area_widget =
218 controller->shelf_widget()->status_area_widget();
219 if (status_area_widget) {
220 WebNotificationTray* notification_tray =
221 status_area_widget->web_notification_tray();
222 if (notification_tray->visible())
223 notification_tray->ShowMessageCenterBubble();
224 }
225 }
226
227 void HandleShowSystemTrayBubble() { 201 void HandleShowSystemTrayBubble() {
228 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble")); 202 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble"));
229 RootWindowController* controller = 203 RootWindowController* controller =
230 RootWindowController::ForTargetRootWindow(); 204 RootWindowController::ForTargetRootWindow();
231 if (!controller->GetSystemTray()->HasSystemBubble()) 205 if (!controller->GetSystemTray()->HasSystemBubble())
232 controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); 206 controller->GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
233 } 207 }
234 208
235 void HandleTakeWindowScreenshot(ScreenshotDelegate* screenshot_delegate) { 209 void HandleTakeWindowScreenshot(ScreenshotDelegate* screenshot_delegate) {
236 base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot")); 210 base::RecordAction(UserMetricsAction("Accel_Take_Window_Screenshot"));
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: 375 case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
402 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: 376 case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
403 return debug::DebugAcceleratorsEnabled(); 377 return debug::DebugAcceleratorsEnabled();
404 case MAGNIFY_SCREEN_ZOOM_IN: 378 case MAGNIFY_SCREEN_ZOOM_IN:
405 case MAGNIFY_SCREEN_ZOOM_OUT: 379 case MAGNIFY_SCREEN_ZOOM_OUT:
406 return CanHandleMagnifyScreen(); 380 return CanHandleMagnifyScreen();
407 case SCALE_UI_DOWN: 381 case SCALE_UI_DOWN:
408 case SCALE_UI_RESET: 382 case SCALE_UI_RESET:
409 case SCALE_UI_UP: 383 case SCALE_UI_UP:
410 return accelerators::IsInternalDisplayZoomEnabled(); 384 return accelerators::IsInternalDisplayZoomEnabled();
411 case SHOW_MESSAGE_CENTER_BUBBLE:
412 return CanHandleShowMessageCenterBubble();
413 case UNPIN: 385 case UNPIN:
414 return CanHandleUnpin(); 386 return CanHandleUnpin();
415 387
416 // Following are always enabled: 388 // Following are always enabled:
417 case ROTATE_SCREEN: 389 case ROTATE_SCREEN:
418 case ROTATE_WINDOW: 390 case ROTATE_WINDOW:
419 case SHOW_SYSTEM_TRAY_BUBBLE: 391 case SHOW_SYSTEM_TRAY_BUBBLE:
420 case TAKE_PARTIAL_SCREENSHOT: 392 case TAKE_PARTIAL_SCREENSHOT:
421 case TAKE_SCREENSHOT: 393 case TAKE_SCREENSHOT:
422 case TAKE_WINDOW_SCREENSHOT: 394 case TAKE_WINDOW_SCREENSHOT:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 break; 459 break;
488 case SCALE_UI_DOWN: 460 case SCALE_UI_DOWN:
489 accelerators::ZoomInternalDisplay(false /* down */); 461 accelerators::ZoomInternalDisplay(false /* down */);
490 break; 462 break;
491 case SCALE_UI_RESET: 463 case SCALE_UI_RESET:
492 accelerators::ResetInternalDisplayZoom(); 464 accelerators::ResetInternalDisplayZoom();
493 break; 465 break;
494 case SCALE_UI_UP: 466 case SCALE_UI_UP:
495 accelerators::ZoomInternalDisplay(true /* up */); 467 accelerators::ZoomInternalDisplay(true /* up */);
496 break; 468 break;
497 case SHOW_MESSAGE_CENTER_BUBBLE:
498 HandleShowMessageCenterBubble();
499 break;
500 case SHOW_SYSTEM_TRAY_BUBBLE: 469 case SHOW_SYSTEM_TRAY_BUBBLE:
501 HandleShowSystemTrayBubble(); 470 HandleShowSystemTrayBubble();
502 break; 471 break;
503 case TAKE_PARTIAL_SCREENSHOT: 472 case TAKE_PARTIAL_SCREENSHOT:
504 HandleTakePartialScreenshot(screenshot_delegate_.get()); 473 HandleTakePartialScreenshot(screenshot_delegate_.get());
505 break; 474 break;
506 case TAKE_SCREENSHOT: 475 case TAKE_SCREENSHOT:
507 HandleTakeScreenshot(screenshot_delegate_.get()); 476 HandleTakeScreenshot(screenshot_delegate_.get());
508 break; 477 break;
509 case TAKE_WINDOW_SCREENSHOT: 478 case TAKE_WINDOW_SCREENSHOT:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 message_center::NotifierId( 547 message_center::NotifierId(
579 message_center::NotifierId::SYSTEM_COMPONENT, 548 message_center::NotifierId::SYSTEM_COMPONENT,
580 system_notifier::kNotifierDeprecatedAccelerator), 549 system_notifier::kNotifierDeprecatedAccelerator),
581 message_center::RichNotificationData(), 550 message_center::RichNotificationData(),
582 new DeprecatedAcceleratorNotificationDelegate)); 551 new DeprecatedAcceleratorNotificationDelegate));
583 message_center::MessageCenter::Get()->AddNotification( 552 message_center::MessageCenter::Get()->AddNotification(
584 std::move(notification)); 553 std::move(notification));
585 } 554 }
586 555
587 } // namespace ash 556 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/aura/wm_root_window_controller_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698