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

Unified Diff: remoting/host/win/session_input_injector.cc

Issue 1403583003: Use standard DOM code definitions instead of custom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows compile. Created 5 years, 2 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
Index: remoting/host/win/session_input_injector.cc
diff --git a/remoting/host/win/session_input_injector.cc b/remoting/host/win/session_input_injector.cc
index fa0d09cf2b9b67ee6f58f6d189b0b1c198f0f2c2..6e6be700844860135d4dd064814bf4060cecec6f 100644
--- a/remoting/host/win/session_input_injector.cc
+++ b/remoting/host/win/session_input_injector.cc
@@ -15,17 +15,17 @@
#include "base/win/windows_version.h"
#include "remoting/host/sas_injector.h"
#include "remoting/proto/event.pb.h"
-#include "remoting/protocol/usb_key_codes.h"
#include "third_party/webrtc/modules/desktop_capture/win/desktop.h"
#include "third_party/webrtc/modules/desktop_capture/win/scoped_thread_desktop.h"
+#include "ui/events/keycodes/dom/dom_code.h"
namespace {
-bool CheckCtrlAndAltArePressed(const std::set<uint32>& pressed_keys) {
- size_t ctrl_keys = pressed_keys.count(kUsbLeftControl) +
- pressed_keys.count(kUsbRightControl);
- size_t alt_keys = pressed_keys.count(kUsbLeftAlt) +
- pressed_keys.count(kUsbRightAlt);
+bool CheckCtrlAndAltArePressed(const std::set<ui::DomCode>& pressed_keys) {
+ size_t ctrl_keys = pressed_keys.count(ui::DomCode::CONTROL_LEFT) +
+ pressed_keys.count(ui::DomCode::CONTROL_RIGHT);
+ size_t alt_keys = pressed_keys.count(ui::DomCode::ALT_LEFT) +
+ pressed_keys.count(ui::DomCode::ALT_RIGHT);
return ctrl_keys != 0 && alt_keys != 0 &&
(ctrl_keys + alt_keys == pressed_keys.size());
}
@@ -86,7 +86,7 @@ class SessionInputInjectorWin::Core
scoped_ptr<SasInjector> sas_injector_;
// Keys currently pressed by the client, used to detect Ctrl-Alt-Del.
- std::set<uint32> pressed_keys_;
+ std::set<ui::DomCode> pressed_keys_;
DISALLOW_COPY_AND_ASSIGN(Core);
};
@@ -136,9 +136,10 @@ void SessionInputInjectorWin::Core::InjectKeyEvent(const KeyEvent& event) {
DCHECK(event.has_pressed());
if (event.has_usb_keycode()) {
+ ui::DomCode dom_code = static_cast<ui::DomCode>(event.usb_keycode());
if (event.pressed()) {
// Simulate secure attention sequence if Ctrl-Alt-Del was just pressed.
- if (event.usb_keycode() == kUsbDelete &&
+ if (dom_code == ui::DomCode::DEL &&
CheckCtrlAndAltArePressed(pressed_keys_)) {
VLOG(3) << "Sending Secure Attention Sequence to the session";
@@ -152,9 +153,9 @@ void SessionInputInjectorWin::Core::InjectKeyEvent(const KeyEvent& event) {
}
}
- pressed_keys_.insert(event.usb_keycode());
+ pressed_keys_.insert(dom_code);
} else {
- pressed_keys_.erase(event.usb_keycode());
+ pressed_keys_.erase(dom_code);
}
}

Powered by Google App Engine
This is Rietveld 408576698