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

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

Issue 2183993005: Moves handling of toggling applist back to common code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_window_delegate
Patch Set: merge Created 4 years, 4 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/common/accelerators/accelerator_controller.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_delegate.h"
15 #include "ash/common/accessibility_types.h" 14 #include "ash/common/accessibility_types.h"
16 #include "ash/common/ash_switches.h" 15 #include "ash/common/ash_switches.h"
17 #include "ash/common/focus_cycler.h" 16 #include "ash/common/focus_cycler.h"
18 #include "ash/common/gpu_support.h" 17 #include "ash/common/gpu_support.h"
19 #include "ash/common/session/session_state_delegate.h" 18 #include "ash/common/session/session_state_delegate.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" 21 #include "ash/common/system/status_area_widget.h"
23 #include "ash/common/system/system_notifier.h" 22 #include "ash/common/system/system_notifier.h"
24 #include "ash/common/system/tray/system_tray.h" 23 #include "ash/common/system/tray/system_tray.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 screenshot_delegate); 271 screenshot_delegate);
273 } 272 }
274 273
275 void HandleTakeScreenshot(ScreenshotDelegate* screenshot_delegate) { 274 void HandleTakeScreenshot(ScreenshotDelegate* screenshot_delegate) {
276 base::RecordAction(UserMetricsAction("Accel_Take_Screenshot")); 275 base::RecordAction(UserMetricsAction("Accel_Take_Screenshot"));
277 DCHECK(screenshot_delegate); 276 DCHECK(screenshot_delegate);
278 if (screenshot_delegate->CanTakeScreenshot()) 277 if (screenshot_delegate->CanTakeScreenshot())
279 screenshot_delegate->HandleTakeScreenshotForAllRootWindows(); 278 screenshot_delegate->HandleTakeScreenshotForAllRootWindows();
280 } 279 }
281 280
282 bool CanHandleToggleAppList(const ui::Accelerator& accelerator,
283 const ui::Accelerator& previous_accelerator) {
284 if (accelerator.key_code() == ui::VKEY_LWIN) {
285 // If something else was pressed between the Search key (LWIN)
286 // being pressed and released, then ignore the release of the
287 // Search key.
288 if (previous_accelerator.type() != ui::ET_KEY_PRESSED ||
289 previous_accelerator.key_code() != ui::VKEY_LWIN) {
290 return false;
291 }
292
293 // When spoken feedback is enabled, we should neither toggle the list nor
294 // consume the key since Search+Shift is one of the shortcuts the a11y
295 // feature uses. crbug.com/132296
296 if (WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled())
297 return false;
298 }
299 return true;
300 }
301
302 void HandleToggleAppList(const ui::Accelerator& accelerator) {
303 if (accelerator.key_code() == ui::VKEY_LWIN)
304 base::RecordAction(UserMetricsAction("Accel_Search_LWin"));
305 WmShell::Get()->ToggleAppList();
306 }
307
308 gfx::ImageSkia CreateWallpaperImage(SkColor fill, SkColor rect) { 281 gfx::ImageSkia CreateWallpaperImage(SkColor fill, SkColor rect) {
309 // TODO(oshima): Consider adding a command line option to control 282 // TODO(oshima): Consider adding a command line option to control
310 // wallpaper images for testing. 283 // wallpaper images for testing.
311 // The size is randomly picked. 284 // The size is randomly picked.
312 gfx::Size image_size(1366, 768); 285 gfx::Size image_size(1366, 768);
313 gfx::Canvas canvas(image_size, 1.0f, true); 286 gfx::Canvas canvas(image_size, 1.0f, true);
314 canvas.DrawColor(fill); 287 canvas.DrawColor(fill);
315 SkPaint paint; 288 SkPaint paint;
316 paint.setColor(rect); 289 paint.setColor(rect);
317 paint.setStrokeWidth(10); 290 paint.setStrokeWidth(10);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 case ROTATE_SCREEN: 392 case ROTATE_SCREEN:
420 case ROTATE_WINDOW: 393 case ROTATE_WINDOW:
421 case SCALE_UI_DOWN: 394 case SCALE_UI_DOWN:
422 case SCALE_UI_RESET: 395 case SCALE_UI_RESET:
423 case SCALE_UI_UP: 396 case SCALE_UI_UP:
424 case SHOW_MESSAGE_CENTER_BUBBLE: 397 case SHOW_MESSAGE_CENTER_BUBBLE:
425 case SHOW_SYSTEM_TRAY_BUBBLE: 398 case SHOW_SYSTEM_TRAY_BUBBLE:
426 case TAKE_PARTIAL_SCREENSHOT: 399 case TAKE_PARTIAL_SCREENSHOT:
427 case TAKE_SCREENSHOT: 400 case TAKE_SCREENSHOT:
428 case TAKE_WINDOW_SCREENSHOT: 401 case TAKE_WINDOW_SCREENSHOT:
429 case TOGGLE_APP_LIST:
430 case UNPIN: 402 case UNPIN:
431 return true; 403 return true;
432 404
433 #if defined(OS_CHROMEOS) 405 #if defined(OS_CHROMEOS)
434 case DEBUG_ADD_REMOVE_DISPLAY: 406 case DEBUG_ADD_REMOVE_DISPLAY:
435 case DEBUG_TOGGLE_UNIFIED_DESKTOP: 407 case DEBUG_TOGGLE_UNIFIED_DESKTOP:
436 case DISABLE_GPU_WATCHDOG: 408 case DISABLE_GPU_WATCHDOG:
437 case LOCK_PRESSED: 409 case LOCK_PRESSED:
438 case LOCK_RELEASED: 410 case LOCK_RELEASED:
439 case POWER_PRESSED: 411 case POWER_PRESSED:
(...skipping 26 matching lines...) Expand all
466 return debug::DebugAcceleratorsEnabled(); 438 return debug::DebugAcceleratorsEnabled();
467 case MAGNIFY_SCREEN_ZOOM_IN: 439 case MAGNIFY_SCREEN_ZOOM_IN:
468 case MAGNIFY_SCREEN_ZOOM_OUT: 440 case MAGNIFY_SCREEN_ZOOM_OUT:
469 return CanHandleMagnifyScreen(); 441 return CanHandleMagnifyScreen();
470 case SCALE_UI_DOWN: 442 case SCALE_UI_DOWN:
471 case SCALE_UI_RESET: 443 case SCALE_UI_RESET:
472 case SCALE_UI_UP: 444 case SCALE_UI_UP:
473 return accelerators::IsInternalDisplayZoomEnabled(); 445 return accelerators::IsInternalDisplayZoomEnabled();
474 case SHOW_MESSAGE_CENTER_BUBBLE: 446 case SHOW_MESSAGE_CENTER_BUBBLE:
475 return CanHandleShowMessageCenterBubble(); 447 return CanHandleShowMessageCenterBubble();
476 case TOGGLE_APP_LIST:
477 return CanHandleToggleAppList(accelerator, previous_accelerator);
478 case UNPIN: 448 case UNPIN:
479 return CanHandleUnpin(); 449 return CanHandleUnpin();
480 450
481 // Following are always enabled: 451 // Following are always enabled:
482 case FOCUS_SHELF: 452 case FOCUS_SHELF:
483 case LAUNCH_APP_0: 453 case LAUNCH_APP_0:
484 case LAUNCH_APP_1: 454 case LAUNCH_APP_1:
485 case LAUNCH_APP_2: 455 case LAUNCH_APP_2:
486 case LAUNCH_APP_3: 456 case LAUNCH_APP_3:
487 case LAUNCH_APP_4: 457 case LAUNCH_APP_4:
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 break; 577 break;
608 case TAKE_PARTIAL_SCREENSHOT: 578 case TAKE_PARTIAL_SCREENSHOT:
609 HandleTakePartialScreenshot(screenshot_delegate_.get()); 579 HandleTakePartialScreenshot(screenshot_delegate_.get());
610 break; 580 break;
611 case TAKE_SCREENSHOT: 581 case TAKE_SCREENSHOT:
612 HandleTakeScreenshot(screenshot_delegate_.get()); 582 HandleTakeScreenshot(screenshot_delegate_.get());
613 break; 583 break;
614 case TAKE_WINDOW_SCREENSHOT: 584 case TAKE_WINDOW_SCREENSHOT:
615 HandleTakeWindowScreenshot(screenshot_delegate_.get()); 585 HandleTakeWindowScreenshot(screenshot_delegate_.get());
616 break; 586 break;
617 case TOGGLE_APP_LIST:
618 HandleToggleAppList(accelerator);
619 break;
620 case UNPIN: 587 case UNPIN:
621 accelerators::Unpin(); 588 accelerators::Unpin();
622 break; 589 break;
623 #if defined(OS_CHROMEOS) 590 #if defined(OS_CHROMEOS)
624 case DEBUG_ADD_REMOVE_DISPLAY: 591 case DEBUG_ADD_REMOVE_DISPLAY:
625 Shell::GetInstance()->display_manager()->AddRemoveDisplay(); 592 Shell::GetInstance()->display_manager()->AddRemoveDisplay();
626 break; 593 break;
627 case DEBUG_TOGGLE_UNIFIED_DESKTOP: 594 case DEBUG_TOGGLE_UNIFIED_DESKTOP:
628 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled( 595 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(
629 !Shell::GetInstance()->display_manager()->unified_desktop_enabled()); 596 !Shell::GetInstance()->display_manager()->unified_desktop_enabled());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 message_center::NotifierId( 653 message_center::NotifierId(
687 message_center::NotifierId::SYSTEM_COMPONENT, 654 message_center::NotifierId::SYSTEM_COMPONENT,
688 system_notifier::kNotifierDeprecatedAccelerator), 655 system_notifier::kNotifierDeprecatedAccelerator),
689 message_center::RichNotificationData(), 656 message_center::RichNotificationData(),
690 new DeprecatedAcceleratorNotificationDelegate)); 657 new DeprecatedAcceleratorNotificationDelegate));
691 message_center::MessageCenter::Get()->AddNotification( 658 message_center::MessageCenter::Get()->AddNotification(
692 std::move(notification)); 659 std::move(notification));
693 } 660 }
694 661
695 } // namespace ash 662 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/accelerators/accelerator_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698