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

Unified Diff: remoting/host/event_executor_win.cc

Issue 9617027: Chromoting: Implemented security attention sequence (SAS) emulation on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/event_executor_win.cc
diff --git a/remoting/host/event_executor_win.cc b/remoting/host/event_executor_win.cc
index b1f58427f4c01799147294faa6b264b37c15ac0d..87fb4656810c07cf6fd5f16afdd9adea9cdd188e 100644
--- a/remoting/host/event_executor_win.cc
+++ b/remoting/host/event_executor_win.cc
@@ -9,10 +9,13 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
+#include "ipc/ipc_channel_proxy.h"
#include "remoting/host/capturer.h"
#include "remoting/proto/event.pb.h"
#include "ui/base/keycodes/keyboard_codes.h"
+#include "remoting/host/chromoting_session_messages.h"
+
namespace remoting {
using protocol::MouseEvent;
@@ -20,10 +23,15 @@ using protocol::KeyEvent;
namespace {
+// Name of the chromoting service IPC channel.
+const char kChromotingSessionChannelName[] = "chromoting_session";
+
// A class to generate events on Windows.
class EventExecutorWin : public EventExecutor {
public:
- EventExecutorWin(MessageLoop* message_loop, Capturer* capturer);
+ EventExecutorWin(MessageLoop* message_loop,
+ IPC::ChannelProxy* chromoting_session,
+ Capturer* capturer);
virtual ~EventExecutorWin() {}
virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
@@ -36,13 +44,21 @@ class EventExecutorWin : public EventExecutor {
MessageLoop* message_loop_;
Capturer* capturer_;
+ // IPC channel connecting the host with the chromoting service.
+ IPC::ChannelProxy* chromoting_session_;
+
+ bool scroll_pressed_;
+
DISALLOW_COPY_AND_ASSIGN(EventExecutorWin);
};
EventExecutorWin::EventExecutorWin(MessageLoop* message_loop,
+ IPC::ChannelProxy* chromoting_session,
Capturer* capturer)
: message_loop_(message_loop),
- capturer_(capturer) {
+ capturer_(capturer),
+ chromoting_session_(chromoting_session),
+ scroll_pressed_(false) {
}
void EventExecutorWin::InjectKeyEvent(const KeyEvent& event) {
@@ -54,6 +70,22 @@ void EventExecutorWin::InjectKeyEvent(const KeyEvent& event) {
return;
}
+ // Poor man's Ctrl+Alt+Delete emulation: a double Scroll Lock is converted to
+ // the security attention sequence.
+ // TODO(alexeypa): replace this with proper SAS handling.
+ if (chromoting_session_ != NULL && event.keycode() == VK_SCROLL) {
+ if (event.pressed()) {
+ if (scroll_pressed_) {
+ chromoting_session_->Send(new ChromotingSessionMsg_SendSasToConsole());
+ scroll_pressed_ = false;
+ } else {
+ scroll_pressed_ = true;
+ }
+ }
+ } else {
+ scroll_pressed_ = false;
+ }
+
HandleKey(event);
}
@@ -168,8 +200,9 @@ void EventExecutorWin::HandleMouse(const MouseEvent& event) {
} // namespace
EventExecutor* EventExecutor::Create(MessageLoop* message_loop,
+ IPC::ChannelProxy* chromoting_session,
Capturer* capturer) {
- return new EventExecutorWin(message_loop, capturer);
+ return new EventExecutorWin(message_loop, chromoting_session, capturer);
}
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698