1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/chromeos/login/ui/webui_accelerator_mapping.h" 6 7 #include <string> 8 9 #include "ash/public/cpp/login_accelerators.h" 10 11 namespace chromeos { 12 13 namespace { 14 15 // These strings must be kept in sync with handleAccelerator() 16 // in display_manager.js. 17 const char kAccelNameCancel[] = "cancel"; 18 const char kAccelNameEnableDebugging[] = "debugging"; 19 const char kAccelNameEnrollment[] = "enrollment"; 20 const char kAccelNameKioskEnable[] = "kiosk_enable"; 21 const char kAccelNameVersion[] = "version"; 22 const char kAccelNameReset[] = "reset"; 23 const char kAccelNameDeviceRequisition[] = "device_requisition"; 24 const char kAccelNameDeviceRequisitionRemora[] = "device_requisition_remora"; 25 const char kAccelNameAppLaunchBailout[] = "app_launch_bailout"; 26 const char kAccelNameAppLaunchNetworkConfig[] = "app_launch_network_config"; 27 const char kAccelNameDemoMode[] = "demo_mode"; 28 const char kAccelSendFeedback[] = "send_feedback"; 29 30 } // namespace 31 MapToWebUIAccelerator(ash::LoginAcceleratorAction action)32std::string MapToWebUIAccelerator(ash::LoginAcceleratorAction action) { 33 switch (action) { 34 case ash::LoginAcceleratorAction::kToggleSystemInfo: 35 return kAccelNameVersion; 36 case ash::LoginAcceleratorAction::kShowFeedback: 37 return kAccelSendFeedback; 38 case ash::LoginAcceleratorAction::kShowResetScreen: 39 return kAccelNameReset; 40 case ash::LoginAcceleratorAction::kAppLaunchBailout: 41 return kAccelNameAppLaunchBailout; 42 case ash::LoginAcceleratorAction::kAppLaunchNetworkConfig: 43 return kAccelNameAppLaunchNetworkConfig; 44 case ash::LoginAcceleratorAction::kCancelScreenAction: 45 return kAccelNameCancel; 46 case ash::LoginAcceleratorAction::kStartEnrollment: 47 return kAccelNameEnrollment; 48 case ash::LoginAcceleratorAction::kEnableConsumerKiosk: 49 return kAccelNameKioskEnable; 50 case ash::LoginAcceleratorAction::kEnableDebugging: 51 return kAccelNameEnableDebugging; 52 case ash::LoginAcceleratorAction::kEditDeviceRequisition: 53 return kAccelNameDeviceRequisition; 54 case ash::LoginAcceleratorAction::kDeviceRequisitionRemora: 55 return kAccelNameDeviceRequisitionRemora; 56 case ash::LoginAcceleratorAction::kStartDemoMode: 57 return kAccelNameDemoMode; 58 } 59 } 60 61 } // namespace chromeos 62