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

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

Issue 2293183002: ash: Remove ash::Shelf in favor of ash::WmShelf (Closed)
Patch Set: rebase again 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/ash.gyp » ('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/focus_cycler.h"
17 #include "ash/common/gpu_support.h" 16 #include "ash/common/gpu_support.h"
18 #include "ash/common/session/session_state_delegate.h" 17 #include "ash/common/session/session_state_delegate.h"
19 #include "ash/common/shelf/shelf.h"
20 #include "ash/common/shelf/shelf_widget.h" 18 #include "ash/common/shelf/shelf_widget.h"
21 #include "ash/common/shelf/wm_shelf.h" 19 #include "ash/common/shelf/wm_shelf.h"
22 #include "ash/common/shell_delegate.h" 20 #include "ash/common/shell_delegate.h"
23 #include "ash/common/shell_window_ids.h" 21 #include "ash/common/shell_window_ids.h"
24 #include "ash/common/system/status_area_widget.h" 22 #include "ash/common/system/status_area_widget.h"
25 #include "ash/common/system/system_notifier.h" 23 #include "ash/common/system/system_notifier.h"
26 #include "ash/common/system/tray/system_tray.h" 24 #include "ash/common/system/tray/system_tray.h"
27 #include "ash/common/system/web_notification/web_notification_tray.h" 25 #include "ash/common/system/web_notification/web_notification_tray.h"
28 #include "ash/common/wallpaper/wallpaper_delegate.h" 26 #include "ash/common/wallpaper/wallpaper_delegate.h"
29 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 27 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 int old_shortcut_id, 126 int old_shortcut_id,
129 int new_shortcut_id) { 127 int new_shortcut_id) {
130 base::string16 old_shortcut = l10n_util::GetStringUTF16(old_shortcut_id); 128 base::string16 old_shortcut = l10n_util::GetStringUTF16(old_shortcut_id);
131 base::string16 new_shortcut = l10n_util::GetStringUTF16(new_shortcut_id); 129 base::string16 new_shortcut = l10n_util::GetStringUTF16(new_shortcut_id);
132 EnsureNoWordBreaks(&old_shortcut); 130 EnsureNoWordBreaks(&old_shortcut);
133 EnsureNoWordBreaks(&new_shortcut); 131 EnsureNoWordBreaks(&new_shortcut);
134 132
135 return l10n_util::GetStringFUTF16(message_id, new_shortcut, old_shortcut); 133 return l10n_util::GetStringFUTF16(message_id, new_shortcut, old_shortcut);
136 } 134 }
137 135
138 void HandleFocusShelf() {
139 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf"));
140 WmShell::Get()->focus_cycler()->FocusWidget(
141 Shelf::ForPrimaryDisplay()->shelf_widget());
142 }
143
144 void HandleLaunchAppN(int n) {
145 base::RecordAction(UserMetricsAction("Accel_Launch_App"));
146 WmShelf::LaunchShelfItem(n);
147 }
148
149 void HandleLaunchLastApp() {
150 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App"));
151 WmShelf::LaunchShelfItem(-1);
152 }
153
154 bool CanHandleMagnifyScreen() { 136 bool CanHandleMagnifyScreen() {
155 return Shell::GetInstance()->magnification_controller()->IsEnabled(); 137 return Shell::GetInstance()->magnification_controller()->IsEnabled();
156 } 138 }
157 139
158 // Magnify the screen 140 // Magnify the screen
159 void HandleMagnifyScreen(int delta_index) { 141 void HandleMagnifyScreen(int delta_index) {
160 if (Shell::GetInstance()->magnification_controller()->IsEnabled()) { 142 if (Shell::GetInstance()->magnification_controller()->IsEnabled()) {
161 // TODO(yoshiki): Move the following logic to MagnificationController. 143 // TODO(yoshiki): Move the following logic to MagnificationController.
162 float scale = Shell::GetInstance()->magnification_controller()->GetScale(); 144 float scale = Shell::GetInstance()->magnification_controller()->GetScale();
163 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale. 145 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 AcceleratorAction action) { 345 AcceleratorAction action) {
364 // NOTE: When adding a new accelerator that only depends on //ash/common code, 346 // NOTE: When adding a new accelerator that only depends on //ash/common code,
365 // add it to accelerator_controller.cc instead. See class comment. 347 // add it to accelerator_controller.cc instead. See class comment.
366 switch (action) { 348 switch (action) {
367 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: 349 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR:
368 case DEBUG_TOGGLE_ROOT_WINDOW_FULL_SCREEN: 350 case DEBUG_TOGGLE_ROOT_WINDOW_FULL_SCREEN:
369 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: 351 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS:
370 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: 352 case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
371 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: 353 case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
372 case DEBUG_TOGGLE_WALLPAPER_MODE: 354 case DEBUG_TOGGLE_WALLPAPER_MODE:
373 case FOCUS_SHELF:
374 case LAUNCH_APP_0:
375 case LAUNCH_APP_1:
376 case LAUNCH_APP_2:
377 case LAUNCH_APP_3:
378 case LAUNCH_APP_4:
379 case LAUNCH_APP_5:
380 case LAUNCH_APP_6:
381 case LAUNCH_APP_7:
382 case LAUNCH_LAST_APP:
383 case MAGNIFY_SCREEN_ZOOM_IN: 355 case MAGNIFY_SCREEN_ZOOM_IN:
384 case MAGNIFY_SCREEN_ZOOM_OUT: 356 case MAGNIFY_SCREEN_ZOOM_OUT:
385 case ROTATE_SCREEN: 357 case ROTATE_SCREEN:
386 case ROTATE_WINDOW: 358 case ROTATE_WINDOW:
387 case SCALE_UI_DOWN: 359 case SCALE_UI_DOWN:
388 case SCALE_UI_RESET: 360 case SCALE_UI_RESET:
389 case SCALE_UI_UP: 361 case SCALE_UI_UP:
390 case SHOW_MESSAGE_CENTER_BUBBLE: 362 case SHOW_MESSAGE_CENTER_BUBBLE:
391 case SHOW_SYSTEM_TRAY_BUBBLE: 363 case SHOW_SYSTEM_TRAY_BUBBLE:
392 case TAKE_PARTIAL_SCREENSHOT: 364 case TAKE_PARTIAL_SCREENSHOT:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 case SCALE_UI_DOWN: 407 case SCALE_UI_DOWN:
436 case SCALE_UI_RESET: 408 case SCALE_UI_RESET:
437 case SCALE_UI_UP: 409 case SCALE_UI_UP:
438 return accelerators::IsInternalDisplayZoomEnabled(); 410 return accelerators::IsInternalDisplayZoomEnabled();
439 case SHOW_MESSAGE_CENTER_BUBBLE: 411 case SHOW_MESSAGE_CENTER_BUBBLE:
440 return CanHandleShowMessageCenterBubble(); 412 return CanHandleShowMessageCenterBubble();
441 case UNPIN: 413 case UNPIN:
442 return CanHandleUnpin(); 414 return CanHandleUnpin();
443 415
444 // Following are always enabled: 416 // Following are always enabled:
445 case FOCUS_SHELF:
446 case LAUNCH_APP_0:
447 case LAUNCH_APP_1:
448 case LAUNCH_APP_2:
449 case LAUNCH_APP_3:
450 case LAUNCH_APP_4:
451 case LAUNCH_APP_5:
452 case LAUNCH_APP_6:
453 case LAUNCH_APP_7:
454 case LAUNCH_LAST_APP:
455 case ROTATE_SCREEN: 417 case ROTATE_SCREEN:
456 case ROTATE_WINDOW: 418 case ROTATE_WINDOW:
457 case SHOW_SYSTEM_TRAY_BUBBLE: 419 case SHOW_SYSTEM_TRAY_BUBBLE:
458 case TAKE_PARTIAL_SCREENSHOT: 420 case TAKE_PARTIAL_SCREENSHOT:
459 case TAKE_SCREENSHOT: 421 case TAKE_SCREENSHOT:
460 case TAKE_WINDOW_SCREENSHOT: 422 case TAKE_WINDOW_SCREENSHOT:
461 return true; 423 return true;
462 424
463 #if defined(OS_CHROMEOS) 425 #if defined(OS_CHROMEOS)
464 case DEBUG_ADD_REMOVE_DISPLAY: 426 case DEBUG_ADD_REMOVE_DISPLAY:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 break; 466 break;
505 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: 467 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS:
506 debug::ToggleShowDebugBorders(); 468 debug::ToggleShowDebugBorders();
507 break; 469 break;
508 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: 470 case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
509 debug::ToggleShowFpsCounter(); 471 debug::ToggleShowFpsCounter();
510 break; 472 break;
511 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: 473 case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
512 debug::ToggleShowPaintRects(); 474 debug::ToggleShowPaintRects();
513 break; 475 break;
514 case FOCUS_SHELF:
515 HandleFocusShelf();
516 break;
517 case LAUNCH_APP_0:
518 HandleLaunchAppN(0);
519 break;
520 case LAUNCH_APP_1:
521 HandleLaunchAppN(1);
522 break;
523 case LAUNCH_APP_2:
524 HandleLaunchAppN(2);
525 break;
526 case LAUNCH_APP_3:
527 HandleLaunchAppN(3);
528 break;
529 case LAUNCH_APP_4:
530 HandleLaunchAppN(4);
531 break;
532 case LAUNCH_APP_5:
533 HandleLaunchAppN(5);
534 break;
535 case LAUNCH_APP_6:
536 HandleLaunchAppN(6);
537 break;
538 case LAUNCH_APP_7:
539 HandleLaunchAppN(7);
540 break;
541 case LAUNCH_LAST_APP:
542 HandleLaunchLastApp();
543 break;
544 case MAGNIFY_SCREEN_ZOOM_IN: 476 case MAGNIFY_SCREEN_ZOOM_IN:
545 HandleMagnifyScreen(1); 477 HandleMagnifyScreen(1);
546 break; 478 break;
547 case MAGNIFY_SCREEN_ZOOM_OUT: 479 case MAGNIFY_SCREEN_ZOOM_OUT:
548 HandleMagnifyScreen(-1); 480 HandleMagnifyScreen(-1);
549 break; 481 break;
550 case ROTATE_SCREEN: 482 case ROTATE_SCREEN:
551 HandleRotateScreen(); 483 HandleRotateScreen();
552 break; 484 break;
553 case ROTATE_WINDOW: 485 case ROTATE_WINDOW:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 message_center::NotifierId( 578 message_center::NotifierId(
647 message_center::NotifierId::SYSTEM_COMPONENT, 579 message_center::NotifierId::SYSTEM_COMPONENT,
648 system_notifier::kNotifierDeprecatedAccelerator), 580 system_notifier::kNotifierDeprecatedAccelerator),
649 message_center::RichNotificationData(), 581 message_center::RichNotificationData(),
650 new DeprecatedAcceleratorNotificationDelegate)); 582 new DeprecatedAcceleratorNotificationDelegate));
651 message_center::MessageCenter::Get()->AddNotification( 583 message_center::MessageCenter::Get()->AddNotification(
652 std::move(notification)); 584 std::move(notification));
653 } 585 }
654 586
655 } // namespace ash 587 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698