-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OOBE: Add common LoginAcceleratorAction table
Bug: 1102393 Change-Id: I676aff22ea638b8a6d892e9306167b8357ccbc77 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283209 Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org> Cr-Commit-Position: refs/heads/master@{#785520}
- Loading branch information
Denis Kuznetsov
authored and
Commit Bot
committed
Jul 6, 2020
1 parent
06695e7
commit 148257e
Showing
13 changed files
with
275 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/public/cpp/login_accelerators.h" | ||
|
||
#include "base/stl_util.h" | ||
|
||
namespace ash { | ||
|
||
// clang-format off | ||
const LoginAcceleratorData kLoginAcceleratorData[] = { | ||
{ | ||
kToggleSystemInfo, | ||
ui::VKEY_V, ui::EF_ALT_DOWN, | ||
true, kScopeOobe | kScopeLogin | kScopeLock, | ||
}, { | ||
kShowFeedback, | ||
ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, | ||
true, kScopeOobe | kScopeLogin, | ||
}, { | ||
kShowResetScreen, | ||
ui::VKEY_R, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, | ||
true, kScopeOobe | kScopeLogin, | ||
}, { | ||
kAppLaunchBailout, | ||
ui::VKEY_S, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | ||
false, kScopeOobe | kScopeLogin, | ||
}, { | ||
kAppLaunchNetworkConfig, | ||
ui::VKEY_N, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | ||
false, kScopeOobe | kScopeLogin, | ||
}, { | ||
kCancelScreenAction, | ||
ui::VKEY_ESCAPE, ui::EF_NONE, | ||
false, kScopeOobe | kScopeLogin, | ||
}, { | ||
kStartEnrollment, | ||
ui::VKEY_E, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | ||
false, kScopeOobe, | ||
}, { | ||
kStartDemoMode, | ||
ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | ||
false, kScopeOobe, | ||
}, { | ||
kEnableDebugging, | ||
ui::VKEY_X, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN, | ||
false, kScopeOobe, | ||
}, { | ||
kEditDeviceRequisition, | ||
ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN, | ||
false, kScopeOobe, | ||
}, { | ||
kDeviceRequisitionRemora, | ||
ui::VKEY_H, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | ||
false, kScopeOobe, | ||
}, { | ||
kEnableConsumerKiosk, | ||
ui::VKEY_K, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, | ||
false, kScopeOobe, | ||
}, | ||
}; | ||
// clang-format on | ||
|
||
const size_t kLoginAcceleratorDataLength = base::size(kLoginAcceleratorData); | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_PUBLIC_CPP_LOGIN_ACCELERATORS_H_ | ||
#define ASH_PUBLIC_CPP_LOGIN_ACCELERATORS_H_ | ||
|
||
#include <stddef.h> | ||
|
||
#include "ash/public/cpp/ash_public_export.h" | ||
#include "ui/events/event_constants.h" | ||
#include "ui/events/keycodes/keyboard_codes.h" | ||
|
||
namespace ash { | ||
|
||
// Accelerator actions specific for out-of-box flow, login and lock screens. | ||
|
||
// Flags that define in which contexts accelerator should be enabled. | ||
enum LoginActionScope { | ||
// Available during out-of-box flow. | ||
kScopeOobe = 1 << 0, | ||
// Available on the login screen. | ||
kScopeLogin = 1 << 1, | ||
// Available on the lock screen. | ||
kScopeLock = 1 << 2, | ||
}; | ||
|
||
enum LoginAcceleratorAction { | ||
kToggleSystemInfo, | ||
kShowFeedback, | ||
kShowResetScreen, | ||
kAppLaunchBailout, | ||
kAppLaunchNetworkConfig, | ||
kCancelScreenAction, | ||
kStartEnrollment, | ||
kEnableConsumerKiosk, | ||
kEnableDebugging, | ||
kEditDeviceRequisition, | ||
kDeviceRequisitionRemora, | ||
kStartDemoMode, | ||
}; | ||
|
||
struct LoginAcceleratorData { | ||
LoginAcceleratorAction action; | ||
ui::KeyboardCode keycode; | ||
// Combination of ui::EventFlags. | ||
int modifiers; | ||
// Defines if accelerator will be registered in AcceleratorController (|true|) | ||
// or only for login/lock dialog view (|false|). | ||
bool global; | ||
// Combination of LoginActionScope flags. | ||
int scope; | ||
}; | ||
|
||
// Accelerators handled by OOBE / Login components. | ||
ASH_PUBLIC_EXPORT extern const LoginAcceleratorData kLoginAcceleratorData[]; | ||
ASH_PUBLIC_EXPORT extern const size_t kLoginAcceleratorDataLength; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_PUBLIC_CPP_LOGIN_ACCELERATORS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
chrome/browser/chromeos/login/ui/webui_accelerator_mapping.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/chromeos/login/ui/webui_accelerator_mapping.h" | ||
|
||
#include <string> | ||
|
||
#include "ash/public/cpp/login_accelerators.h" | ||
|
||
namespace chromeos { | ||
|
||
namespace { | ||
|
||
// These strings must be kept in sync with handleAccelerator() | ||
// in display_manager.js. | ||
const char kAccelNameCancel[] = "cancel"; | ||
const char kAccelNameEnableDebugging[] = "debugging"; | ||
const char kAccelNameEnrollment[] = "enrollment"; | ||
const char kAccelNameKioskEnable[] = "kiosk_enable"; | ||
const char kAccelNameVersion[] = "version"; | ||
const char kAccelNameReset[] = "reset"; | ||
const char kAccelNameDeviceRequisition[] = "device_requisition"; | ||
const char kAccelNameDeviceRequisitionRemora[] = "device_requisition_remora"; | ||
const char kAccelNameAppLaunchBailout[] = "app_launch_bailout"; | ||
const char kAccelNameAppLaunchNetworkConfig[] = "app_launch_network_config"; | ||
const char kAccelNameDemoMode[] = "demo_mode"; | ||
const char kAccelSendFeedback[] = "send_feedback"; | ||
|
||
} // namespace | ||
|
||
std::string MapToWebUIAccelerator(ash::LoginAcceleratorAction action) { | ||
switch (action) { | ||
case ash::LoginAcceleratorAction::kToggleSystemInfo: | ||
return kAccelNameVersion; | ||
case ash::LoginAcceleratorAction::kShowFeedback: | ||
return kAccelSendFeedback; | ||
case ash::LoginAcceleratorAction::kShowResetScreen: | ||
return kAccelNameReset; | ||
case ash::LoginAcceleratorAction::kAppLaunchBailout: | ||
return kAccelNameAppLaunchBailout; | ||
case ash::LoginAcceleratorAction::kAppLaunchNetworkConfig: | ||
return kAccelNameAppLaunchNetworkConfig; | ||
case ash::LoginAcceleratorAction::kCancelScreenAction: | ||
return kAccelNameCancel; | ||
case ash::LoginAcceleratorAction::kStartEnrollment: | ||
return kAccelNameEnrollment; | ||
case ash::LoginAcceleratorAction::kEnableConsumerKiosk: | ||
return kAccelNameKioskEnable; | ||
case ash::LoginAcceleratorAction::kEnableDebugging: | ||
return kAccelNameEnableDebugging; | ||
case ash::LoginAcceleratorAction::kEditDeviceRequisition: | ||
return kAccelNameDeviceRequisition; | ||
case ash::LoginAcceleratorAction::kDeviceRequisitionRemora: | ||
return kAccelNameDeviceRequisitionRemora; | ||
case ash::LoginAcceleratorAction::kStartDemoMode: | ||
return kAccelNameDemoMode; | ||
} | ||
} | ||
|
||
} // namespace chromeos |
Oops, something went wrong.