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

Unified Diff: remoting/host/input_injector_chromeos.cc

Issue 2852813002: When receiving a key event on ChromeOS, set host lock state to match client's (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/input_injector_chromeos.cc
diff --git a/remoting/host/input_injector_chromeos.cc b/remoting/host/input_injector_chromeos.cc
index 65c58de51e89407aecacc3fd941a3d05a6e87ae8..1398e3f864c84e35cfefe71ce0abfe561482f073 100644
--- a/remoting/host/input_injector_chromeos.cc
+++ b/remoting/host/input_injector_chromeos.cc
@@ -60,6 +60,9 @@ class InputInjectorChromeos::Core {
void Start(std::unique_ptr<protocol::ClipboardStub> client_clipboard);
private:
+ // Sets the caps lock state to match states
+ void SetLockStates(uint32_t states);
+
std::unique_ptr<ui::SystemInputInjector> delegate_;
std::unique_ptr<Clipboard> clipboard_;
@@ -82,6 +85,10 @@ void InputInjectorChromeos::Core::InjectKeyEvent(const KeyEvent& event) {
DCHECK(event.has_pressed());
DCHECK(event.has_usb_keycode());
+ if (event.has_lock_states()) {
+ SetLockStates(event.lock_states());
+ }
+
ui::DomCode dom_code =
ui::KeycodeConverter::UsbKeycodeToDomCode(event.usb_keycode());
@@ -123,6 +130,13 @@ void InputInjectorChromeos::Core::Start(
point_transformer_.reset(new PointTransformer());
}
+void InputInjectorChromeos::Core::SetLockStates(uint32_t states) {
+ ui::InputController* input_controller =
+ ui::OzonePlatform::GetInstance()->GetInputController();
+ input_controller->SetCapsLockEnabled(
+ states & protocol::KeyEvent::LOCK_STATES_CAPSLOCK);
+}
+
InputInjectorChromeos::InputInjectorChromeos(
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: input_task_runner_(task_runner) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698