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

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

Issue 2724163002: ash: Use enum for SessionController::CycleActiveUser (Closed)
Patch Set: fix ash_shell_with_content compile 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 | « no previous file | ash/common/session/session_controller.h » ('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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 void HandleSuspend() { 408 void HandleSuspend() {
409 base::RecordAction(UserMetricsAction("Accel_Suspend")); 409 base::RecordAction(UserMetricsAction("Accel_Suspend"));
410 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); 410 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend();
411 } 411 }
412 412
413 bool CanHandleCycleUser() { 413 bool CanHandleCycleUser() {
414 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() && 414 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() &&
415 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1; 415 WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers() > 1;
416 } 416 }
417 417
418 void HandleCycleUser(SessionStateDelegate::CycleUser cycle_user) { 418 void HandleCycleUser(CycleUserDirection direction) {
419 MultiProfileUMA::RecordSwitchActiveUser( 419 MultiProfileUMA::RecordSwitchActiveUser(
420 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_ACCELERATOR); 420 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_ACCELERATOR);
421 switch (cycle_user) { 421 switch (direction) {
422 case SessionStateDelegate::CYCLE_TO_NEXT_USER: 422 case CycleUserDirection::NEXT:
423 base::RecordAction(UserMetricsAction("Accel_Switch_To_Next_User")); 423 base::RecordAction(UserMetricsAction("Accel_Switch_To_Next_User"));
424 break; 424 break;
425 case SessionStateDelegate::CYCLE_TO_PREVIOUS_USER: 425 case CycleUserDirection::PREVIOUS:
426 base::RecordAction(UserMetricsAction("Accel_Switch_To_Previous_User")); 426 base::RecordAction(UserMetricsAction("Accel_Switch_To_Previous_User"));
427 break; 427 break;
428 } 428 }
429 WmShell::Get()->GetSessionStateDelegate()->CycleActiveUser(cycle_user); 429 WmShell::Get()->GetSessionStateDelegate()->CycleActiveUser(direction);
430 } 430 }
431 431
432 bool CanHandleToggleCapsLock(const ui::Accelerator& accelerator, 432 bool CanHandleToggleCapsLock(const ui::Accelerator& accelerator,
433 const ui::Accelerator& previous_accelerator) { 433 const ui::Accelerator& previous_accelerator) {
434 chromeos::input_method::InputMethodManager* ime = 434 chromeos::input_method::InputMethodManager* ime =
435 chromeos::input_method::InputMethodManager::Get(); 435 chromeos::input_method::InputMethodManager::Get();
436 436
437 // This shortcust is set to be trigger on release. Either the current 437 // This shortcust is set to be trigger on release. Either the current
438 // accelerator is a Search release or Alt release. 438 // accelerator is a Search release or Alt release.
439 if (accelerator.key_code() == ui::VKEY_LWIN && 439 if (accelerator.key_code() == ui::VKEY_LWIN &&
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 case SHOW_TASK_MANAGER: 1018 case SHOW_TASK_MANAGER:
1019 HandleShowTaskManager(); 1019 HandleShowTaskManager();
1020 break; 1020 break;
1021 case SUSPEND: 1021 case SUSPEND:
1022 HandleSuspend(); 1022 HandleSuspend();
1023 break; 1023 break;
1024 case SWITCH_IME: 1024 case SWITCH_IME:
1025 HandleSwitchIme(ime_control_delegate_.get(), accelerator); 1025 HandleSwitchIme(ime_control_delegate_.get(), accelerator);
1026 break; 1026 break;
1027 case SWITCH_TO_NEXT_USER: 1027 case SWITCH_TO_NEXT_USER:
1028 HandleCycleUser(SessionStateDelegate::CYCLE_TO_NEXT_USER); 1028 HandleCycleUser(CycleUserDirection::NEXT);
1029 break; 1029 break;
1030 case SWITCH_TO_PREVIOUS_USER: 1030 case SWITCH_TO_PREVIOUS_USER:
1031 HandleCycleUser(SessionStateDelegate::CYCLE_TO_PREVIOUS_USER); 1031 HandleCycleUser(CycleUserDirection::PREVIOUS);
1032 break; 1032 break;
1033 case TOGGLE_APP_LIST: 1033 case TOGGLE_APP_LIST:
1034 HandleToggleAppList(accelerator); 1034 HandleToggleAppList(accelerator);
1035 break; 1035 break;
1036 case TOGGLE_CAPS_LOCK: 1036 case TOGGLE_CAPS_LOCK:
1037 HandleToggleCapsLock(); 1037 HandleToggleCapsLock();
1038 break; 1038 break;
1039 case TOGGLE_FULLSCREEN: 1039 case TOGGLE_FULLSCREEN:
1040 HandleToggleFullscreen(accelerator); 1040 HandleToggleFullscreen(accelerator);
1041 break; 1041 break;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 data->old_shortcut_id, data->new_shortcut_id); 1164 data->old_shortcut_id, data->new_shortcut_id);
1165 } 1165 }
1166 1166
1167 if (!data->deprecated_enabled) 1167 if (!data->deprecated_enabled)
1168 return AcceleratorProcessingStatus::STOP; 1168 return AcceleratorProcessingStatus::STOP;
1169 1169
1170 return AcceleratorProcessingStatus::PROCEED; 1170 return AcceleratorProcessingStatus::PROCEED;
1171 } 1171 }
1172 1172
1173 } // namespace ash 1173 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/session/session_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698