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

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

Issue 2741273002: chromeos: Promotes more from WmShell to Shell (Closed)
Patch Set: feedback 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 void HandleMediaPlayPause() { 138 void HandleMediaPlayPause() {
139 WmShell::Get()->media_controller()->HandleMediaPlayPause(); 139 WmShell::Get()->media_controller()->HandleMediaPlayPause();
140 } 140 }
141 141
142 void HandleMediaPrevTrack() { 142 void HandleMediaPrevTrack() {
143 WmShell::Get()->media_controller()->HandleMediaPrevTrack(); 143 WmShell::Get()->media_controller()->HandleMediaPrevTrack();
144 } 144 }
145 145
146 bool CanHandleNewIncognitoWindow() { 146 bool CanHandleNewIncognitoWindow() {
147 return WmShell::Get()->delegate()->IsIncognitoAllowed(); 147 return Shell::Get()->shell_delegate()->IsIncognitoAllowed();
148 } 148 }
149 149
150 void HandleNewIncognitoWindow() { 150 void HandleNewIncognitoWindow() {
151 base::RecordAction(UserMetricsAction("Accel_New_Incognito_Window")); 151 base::RecordAction(UserMetricsAction("Accel_New_Incognito_Window"));
152 WmShell::Get()->new_window_controller()->NewWindow(true /* is_incognito */); 152 WmShell::Get()->new_window_controller()->NewWindow(true /* is_incognito */);
153 } 153 }
154 154
155 void HandleNewTab(const ui::Accelerator& accelerator) { 155 void HandleNewTab(const ui::Accelerator& accelerator) {
156 if (accelerator.key_code() == ui::VKEY_T) 156 if (accelerator.key_code() == ui::VKEY_T)
157 base::RecordAction(UserMetricsAction("Accel_NewTab_T")); 157 base::RecordAction(UserMetricsAction("Accel_NewTab_T"));
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 return Shell::GetInstance()->palette_delegate() && 407 return Shell::GetInstance()->palette_delegate() &&
408 Shell::GetInstance()->palette_delegate()->ShouldShowPalette(); 408 Shell::GetInstance()->palette_delegate()->ShouldShowPalette();
409 } 409 }
410 410
411 void HandleSuspend() { 411 void HandleSuspend() {
412 base::RecordAction(UserMetricsAction("Accel_Suspend")); 412 base::RecordAction(UserMetricsAction("Accel_Suspend"));
413 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); 413 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend();
414 } 414 }
415 415
416 bool CanHandleCycleUser() { 416 bool CanHandleCycleUser() {
417 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() && 417 return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() &&
418 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1; 418 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1;
419 } 419 }
420 420
421 void HandleCycleUser(CycleUserDirection direction) { 421 void HandleCycleUser(CycleUserDirection direction) {
422 MultiProfileUMA::RecordSwitchActiveUser( 422 MultiProfileUMA::RecordSwitchActiveUser(
423 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_ACCELERATOR); 423 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_ACCELERATOR);
424 switch (direction) { 424 switch (direction) {
425 case CycleUserDirection::NEXT: 425 case CycleUserDirection::NEXT:
426 base::RecordAction(UserMetricsAction("Accel_Switch_To_Next_User")); 426 base::RecordAction(UserMetricsAction("Accel_Switch_To_Next_User"));
427 break; 427 break;
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 if (!wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted() && 1103 if (!wm_shell->GetSessionStateDelegate()->IsActiveUserSessionStarted() &&
1104 actions_allowed_at_login_screen_.find(action) == 1104 actions_allowed_at_login_screen_.find(action) ==
1105 actions_allowed_at_login_screen_.end()) { 1105 actions_allowed_at_login_screen_.end()) {
1106 return RESTRICTION_PREVENT_PROCESSING; 1106 return RESTRICTION_PREVENT_PROCESSING;
1107 } 1107 }
1108 if (wm_shell->GetSessionStateDelegate()->IsScreenLocked() && 1108 if (wm_shell->GetSessionStateDelegate()->IsScreenLocked() &&
1109 actions_allowed_at_lock_screen_.find(action) == 1109 actions_allowed_at_lock_screen_.find(action) ==
1110 actions_allowed_at_lock_screen_.end()) { 1110 actions_allowed_at_lock_screen_.end()) {
1111 return RESTRICTION_PREVENT_PROCESSING; 1111 return RESTRICTION_PREVENT_PROCESSING;
1112 } 1112 }
1113 if (wm_shell->delegate()->IsRunningInForcedAppMode() && 1113 if (Shell::Get()->shell_delegate()->IsRunningInForcedAppMode() &&
1114 actions_allowed_in_app_mode_.find(action) == 1114 actions_allowed_in_app_mode_.find(action) ==
1115 actions_allowed_in_app_mode_.end()) { 1115 actions_allowed_in_app_mode_.end()) {
1116 return RESTRICTION_PREVENT_PROCESSING; 1116 return RESTRICTION_PREVENT_PROCESSING;
1117 } 1117 }
1118 if (WmShell::Get()->IsSystemModalWindowOpen() && 1118 if (WmShell::Get()->IsSystemModalWindowOpen() &&
1119 actions_allowed_at_modal_window_.find(action) == 1119 actions_allowed_at_modal_window_.find(action) ==
1120 actions_allowed_at_modal_window_.end()) { 1120 actions_allowed_at_modal_window_.end()) {
1121 // Note we prevent the shortcut from propagating so it will not 1121 // Note we prevent the shortcut from propagating so it will not
1122 // 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
1123 // 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
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 data->old_shortcut_id, data->new_shortcut_id); 1167 data->old_shortcut_id, data->new_shortcut_id);
1168 } 1168 }
1169 1169
1170 if (!data->deprecated_enabled) 1170 if (!data->deprecated_enabled)
1171 return AcceleratorProcessingStatus::STOP; 1171 return AcceleratorProcessingStatus::STOP;
1172 1172
1173 return AcceleratorProcessingStatus::PROCEED; 1173 return AcceleratorProcessingStatus::PROCEED;
1174 } 1174 }
1175 1175
1176 } // 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