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

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

Issue 2738133003: Promotes a handful of members from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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 | « ash/common/DEPS ('k') | ash/common/accelerators/debug_commands.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/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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // being pressed and released, then ignore the release of the 256 // being pressed and released, then ignore the release of the
257 // Search key. 257 // Search key.
258 if (previous_accelerator.type() != ui::ET_KEY_PRESSED || 258 if (previous_accelerator.type() != ui::ET_KEY_PRESSED ||
259 previous_accelerator.key_code() != ui::VKEY_LWIN) { 259 previous_accelerator.key_code() != ui::VKEY_LWIN) {
260 return false; 260 return false;
261 } 261 }
262 262
263 // When spoken feedback is enabled, we should neither toggle the list nor 263 // When spoken feedback is enabled, we should neither toggle the list nor
264 // consume the key since Search+Shift is one of the shortcuts the a11y 264 // consume the key since Search+Shift is one of the shortcuts the a11y
265 // feature uses. crbug.com/132296 265 // feature uses. crbug.com/132296
266 if (WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled()) 266 if (Shell::GetInstance()
267 ->accessibility_delegate()
268 ->IsSpokenFeedbackEnabled())
267 return false; 269 return false;
268 } 270 }
269 return true; 271 return true;
270 } 272 }
271 273
272 void HandleToggleAppList(const ui::Accelerator& accelerator) { 274 void HandleToggleAppList(const ui::Accelerator& accelerator) {
273 if (accelerator.key_code() == ui::VKEY_LWIN) 275 if (accelerator.key_code() == ui::VKEY_LWIN)
274 base::RecordAction(UserMetricsAction("Accel_Search_LWin")); 276 base::RecordAction(UserMetricsAction("Accel_Search_LWin"));
275 WmShell::Get()->ToggleAppList(); 277 WmShell::Get()->ToggleAppList();
276 } 278 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools")); 397 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools"));
396 398
397 RootWindowController* root_window_controller = 399 RootWindowController* root_window_controller =
398 Shell::GetWmRootWindowForNewWindows()->GetRootWindowController(); 400 Shell::GetWmRootWindowForNewWindows()->GetRootWindowController();
399 PaletteTray* palette_tray = 401 PaletteTray* palette_tray =
400 root_window_controller->GetShelf()->GetStatusAreaWidget()->palette_tray(); 402 root_window_controller->GetShelf()->GetStatusAreaWidget()->palette_tray();
401 palette_tray->ShowPalette(); 403 palette_tray->ShowPalette();
402 } 404 }
403 405
404 bool CanHandleShowStylusTools() { 406 bool CanHandleShowStylusTools() {
405 return WmShell::Get()->palette_delegate() && 407 return Shell::GetInstance()->palette_delegate() &&
406 WmShell::Get()->palette_delegate()->ShouldShowPalette(); 408 Shell::GetInstance()->palette_delegate()->ShouldShowPalette();
407 } 409 }
408 410
409 void HandleSuspend() { 411 void HandleSuspend() {
410 base::RecordAction(UserMetricsAction("Accel_Suspend")); 412 base::RecordAction(UserMetricsAction("Accel_Suspend"));
411 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); 413 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend();
412 } 414 }
413 415
414 bool CanHandleCycleUser() { 416 bool CanHandleCycleUser() {
415 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() && 417 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() &&
416 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1; 418 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 kHighContrastToggleAccelNotificationId, base::string16() /* title */, 486 kHighContrastToggleAccelNotificationId, base::string16() /* title */,
485 l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_ACCEL_MSG), 487 l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_ACCEL_MSG),
486 gfx::Image(CreateVectorIcon(kSystemMenuAccessibilityIcon, SK_ColorBLACK)), 488 gfx::Image(CreateVectorIcon(kSystemMenuAccessibilityIcon, SK_ColorBLACK)),
487 base::string16() /* display source */, GURL(), 489 base::string16() /* display source */, GURL(),
488 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, 490 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
489 system_notifier::kNotifierAccessibility), 491 system_notifier::kNotifierAccessibility),
490 message_center::RichNotificationData(), nullptr)); 492 message_center::RichNotificationData(), nullptr));
491 message_center::MessageCenter::Get()->AddNotification( 493 message_center::MessageCenter::Get()->AddNotification(
492 std::move(notification)); 494 std::move(notification));
493 495
494 WmShell::Get()->accessibility_delegate()->ToggleHighContrast(); 496 Shell::GetInstance()->accessibility_delegate()->ToggleHighContrast();
495 } 497 }
496 498
497 void HandleToggleSpokenFeedback() { 499 void HandleToggleSpokenFeedback() {
498 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback")); 500 base::RecordAction(UserMetricsAction("Accel_Toggle_Spoken_Feedback"));
499 501
500 WmShell::Get()->accessibility_delegate()->ToggleSpokenFeedback( 502 Shell::GetInstance()->accessibility_delegate()->ToggleSpokenFeedback(
501 A11Y_NOTIFICATION_SHOW); 503 A11Y_NOTIFICATION_SHOW);
502 } 504 }
503 505
504 void HandleVolumeDown(mojom::VolumeController* volume_controller, 506 void HandleVolumeDown(mojom::VolumeController* volume_controller,
505 const ui::Accelerator& accelerator) { 507 const ui::Accelerator& accelerator) {
506 if (accelerator.key_code() == ui::VKEY_VOLUME_DOWN) 508 if (accelerator.key_code() == ui::VKEY_VOLUME_DOWN)
507 base::RecordAction(UserMetricsAction("Accel_VolumeDown_F9")); 509 base::RecordAction(UserMetricsAction("Accel_VolumeDown_F9"));
508 510
509 if (volume_controller) 511 if (volume_controller)
510 volume_controller->VolumeDown(); 512 volume_controller->VolumeDown();
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 actions_allowed_at_modal_window_.find(action) == 1119 actions_allowed_at_modal_window_.find(action) ==
1118 actions_allowed_at_modal_window_.end()) { 1120 actions_allowed_at_modal_window_.end()) {
1119 // Note we prevent the shortcut from propagating so it will not 1121 // Note we prevent the shortcut from propagating so it will not
1120 // be passed to the modal window. This is important for things like 1122 // be passed to the modal window. This is important for things like
1121 // Alt+Tab that would cause an undesired effect in the modal window by 1123 // Alt+Tab that would cause an undesired effect in the modal window by
1122 // cycling through its window elements. 1124 // cycling through its window elements.
1123 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 1125 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
1124 } 1126 }
1125 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && 1127 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
1126 actions_needing_window_.find(action) != actions_needing_window_.end()) { 1128 actions_needing_window_.find(action) != actions_needing_window_.end()) {
1127 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 1129 Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert(
1128 A11Y_ALERT_WINDOW_NEEDED); 1130 A11Y_ALERT_WINDOW_NEEDED);
1129 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 1131 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
1130 } 1132 }
1131 return RESTRICTION_NONE; 1133 return RESTRICTION_NONE;
1132 } 1134 }
1133 1135
1134 AcceleratorController::AcceleratorProcessingStatus 1136 AcceleratorController::AcceleratorProcessingStatus
1135 AcceleratorController::MaybeDeprecatedAcceleratorPressed( 1137 AcceleratorController::MaybeDeprecatedAcceleratorPressed(
1136 AcceleratorAction action, 1138 AcceleratorAction action,
1137 const ui::Accelerator& accelerator) const { 1139 const ui::Accelerator& accelerator) const {
(...skipping 27 matching lines...) Expand all
1165 data->old_shortcut_id, data->new_shortcut_id); 1167 data->old_shortcut_id, data->new_shortcut_id);
1166 } 1168 }
1167 1169
1168 if (!data->deprecated_enabled) 1170 if (!data->deprecated_enabled)
1169 return AcceleratorProcessingStatus::STOP; 1171 return AcceleratorProcessingStatus::STOP;
1170 1172
1171 return AcceleratorProcessingStatus::PROCEED; 1173 return AcceleratorProcessingStatus::PROCEED;
1172 } 1174 }
1173 1175
1174 } // namespace ash 1176 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/DEPS ('k') | ash/common/accelerators/debug_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698