summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-27 20:25:39 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-27 20:25:39 +0000
commit529bbd15cb37ed16f96efb0de94b8ccf73cd1787 (patch)
tree6b488f4cd318eaf553b90df389f3f325640cf7c8 /remoting/host
parent6e9def1ccf30f6747abc1597e8db10236fcb5e8a (diff)
downloadchromium_src-529bbd15cb37ed16f96efb0de94b8ccf73cd1787.zip
chromium_src-529bbd15cb37ed16f96efb0de94b8ccf73cd1787.tar.gz
chromium_src-529bbd15cb37ed16f96efb0de94b8ccf73cd1787.tar.bz2
Add TextEvent message in the protocol
The new message will be used for non-keyboard input methods and software keyboards. BUG=270356 R=lambroslambrou@chromium.org, nasko@chromium.org Review URL: https://codereview.chromium.org/197613004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259968 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/chromoting_messages.h5
-rw-r--r--remoting/host/desktop_session_agent.cc22
-rw-r--r--remoting/host/desktop_session_agent.h1
-rw-r--r--remoting/host/desktop_session_proxy.cc13
-rw-r--r--remoting/host/desktop_session_proxy.h1
-rw-r--r--remoting/host/host_mock_objects.h1
-rw-r--r--remoting/host/input_injector_linux.cc11
-rw-r--r--remoting/host/input_injector_mac.cc14
-rw-r--r--remoting/host/input_injector_win.cc22
-rw-r--r--remoting/host/ipc_desktop_environment_unittest.cc68
-rw-r--r--remoting/host/ipc_input_injector.cc4
-rw-r--r--remoting/host/ipc_input_injector.h1
-rw-r--r--remoting/host/remote_input_filter.cc6
-rw-r--r--remoting/host/remote_input_filter.h1
-rw-r--r--remoting/host/win/session_input_injector.cc20
-rw-r--r--remoting/host/win/session_input_injector.h1
16 files changed, 151 insertions, 40 deletions
diff --git a/remoting/host/chromoting_messages.h b/remoting/host/chromoting_messages.h
index f83e308..f28feaa 100644
--- a/remoting/host/chromoting_messages.h
+++ b/remoting/host/chromoting_messages.h
@@ -217,6 +217,11 @@ IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectClipboardEvent,
IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectKeyEvent,
std::string /* serialized_event */ )
+// Carries a keyboard event from the client to the desktop session agent.
+// |serialized_event| is a serialized protocol::TextEvent.
+IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectTextEvent,
+ std::string /* serialized_event */ )
+
// Carries a mouse event from the client to the desktop session agent.
// |serialized_event| is a serialized protocol::MouseEvent.
IPC_MESSAGE_CONTROL1(ChromotingNetworkDesktopMsg_InjectMouseEvent,
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 1597765..4f023a6 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -139,6 +139,8 @@ bool DesktopSessionAgent::OnMessageReceived(const IPC::Message& message) {
OnInjectClipboardEvent)
IPC_MESSAGE_HANDLER(ChromotingNetworkDesktopMsg_InjectKeyEvent,
OnInjectKeyEvent)
+ IPC_MESSAGE_HANDLER(ChromotingNetworkDesktopMsg_InjectTextEvent,
+ OnInjectTextEvent)
IPC_MESSAGE_HANDLER(ChromotingNetworkDesktopMsg_InjectMouseEvent,
OnInjectMouseEvent)
IPC_MESSAGE_HANDLER(ChromotingNetworkDesktopMsg_SetScreenResolution,
@@ -459,6 +461,26 @@ void DesktopSessionAgent::OnInjectKeyEvent(
remote_input_filter_->InjectKeyEvent(event);
}
+void DesktopSessionAgent::OnInjectTextEvent(
+ const std::string& serialized_event) {
+ DCHECK(caller_task_runner_->BelongsToCurrentThread());
+
+ protocol::TextEvent event;
+ if (!event.ParseFromString(serialized_event)) {
+ LOG(ERROR) << "Failed to parse protocol::TextEvent.";
+ return;
+ }
+
+ // InputStub implementations must verify events themselves, so we need only
+ // basic verification here. This matches HostEventDispatcher.
+ if (!event.has_text()) {
+ LOG(ERROR) << "Received invalid TextEvent.";
+ return;
+ }
+
+ remote_input_filter_->InjectTextEvent(event);
+}
+
void DesktopSessionAgent::OnInjectMouseEvent(
const std::string& serialized_event) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
diff --git a/remoting/host/desktop_session_agent.h b/remoting/host/desktop_session_agent.h
index 0421eeb..82c02fd 100644
--- a/remoting/host/desktop_session_agent.h
+++ b/remoting/host/desktop_session_agent.h
@@ -124,6 +124,7 @@ class DesktopSessionAgent
// Handles event executor requests from the client.
void OnInjectClipboardEvent(const std::string& serialized_event);
void OnInjectKeyEvent(const std::string& serialized_event);
+ void OnInjectTextEvent(const std::string& serialized_event);
void OnInjectMouseEvent(const std::string& serialized_event);
// Handles ChromotingNetworkDesktopMsg_SetScreenResolution request from
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index 058a2f4..d077d5a 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -353,6 +353,19 @@ void DesktopSessionProxy::InjectKeyEvent(const protocol::KeyEvent& event) {
new ChromotingNetworkDesktopMsg_InjectKeyEvent(serialized_event));
}
+void DesktopSessionProxy::InjectTextEvent(const protocol::TextEvent& event) {
+ DCHECK(caller_task_runner_->BelongsToCurrentThread());
+
+ std::string serialized_event;
+ if (!event.SerializeToString(&serialized_event)) {
+ LOG(ERROR) << "Failed to serialize protocol::TextEvent.";
+ return;
+ }
+
+ SendToDesktop(
+ new ChromotingNetworkDesktopMsg_InjectTextEvent(serialized_event));
+}
+
void DesktopSessionProxy::InjectMouseEvent(const protocol::MouseEvent& event) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h
index 14f3ff7..1414c61 100644
--- a/remoting/host/desktop_session_proxy.h
+++ b/remoting/host/desktop_session_proxy.h
@@ -112,6 +112,7 @@ class DesktopSessionProxy
// APIs used to implement the InputInjector interface.
void InjectClipboardEvent(const protocol::ClipboardEvent& event);
void InjectKeyEvent(const protocol::KeyEvent& event);
+ void InjectTextEvent(const protocol::TextEvent& event);
void InjectMouseEvent(const protocol::MouseEvent& event);
void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard);
diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h
index e8bad3e..d365695 100644
--- a/remoting/host/host_mock_objects.h
+++ b/remoting/host/host_mock_objects.h
@@ -106,6 +106,7 @@ class MockInputInjector : public InputInjector {
MOCK_METHOD1(InjectClipboardEvent,
void(const protocol::ClipboardEvent& event));
MOCK_METHOD1(InjectKeyEvent, void(const protocol::KeyEvent& event));
+ MOCK_METHOD1(InjectTextEvent, void(const protocol::TextEvent& event));
MOCK_METHOD1(InjectMouseEvent, void(const protocol::MouseEvent& event));
MOCK_METHOD1(StartPtr,
void(protocol::ClipboardStub* client_clipboard));
diff --git a/remoting/host/input_injector_linux.cc b/remoting/host/input_injector_linux.cc
index f6f80a2..c9763b2 100644
--- a/remoting/host/input_injector_linux.cc
+++ b/remoting/host/input_injector_linux.cc
@@ -27,6 +27,7 @@ namespace {
using protocol::ClipboardEvent;
using protocol::KeyEvent;
+using protocol::TextEvent;
using protocol::MouseEvent;
// Pixel-to-wheel-ticks conversion ratio used by GTK.
@@ -47,6 +48,7 @@ class InputInjectorLinux : public InputInjector {
// InputStub interface.
virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
+ virtual void InjectTextEvent(const TextEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
// InputInjector interface.
@@ -66,6 +68,7 @@ class InputInjectorLinux : public InputInjector {
// Mirrors the InputStub interface.
void InjectKeyEvent(const KeyEvent& event);
+ void InjectTextEvent(const TextEvent& event);
void InjectMouseEvent(const MouseEvent& event);
// Mirrors the InputInjector interface.
@@ -148,6 +151,10 @@ void InputInjectorLinux::InjectKeyEvent(const KeyEvent& event) {
core_->InjectKeyEvent(event);
}
+void InputInjectorLinux::InjectTextEvent(const TextEvent& event) {
+ core_->InjectTextEvent(event);
+}
+
void InputInjectorLinux::InjectMouseEvent(const MouseEvent& event) {
core_->InjectMouseEvent(event);
}
@@ -253,6 +260,10 @@ void InputInjectorLinux::Core::InjectKeyEvent(const KeyEvent& event) {
XFlush(display_);
}
+void InputInjectorLinux::Core::InjectTextEvent(const TextEvent& event) {
+ NOTIMPLEMENTED();
+}
+
InputInjectorLinux::Core::~Core() {
CHECK(pressed_keys_.empty());
}
diff --git a/remoting/host/input_injector_mac.cc b/remoting/host/input_injector_mac.cc
index 51fb09c..b450674 100644
--- a/remoting/host/input_injector_mac.cc
+++ b/remoting/host/input_injector_mac.cc
@@ -37,6 +37,7 @@ const int kVK_RightCommand = 0x36;
using protocol::ClipboardEvent;
using protocol::KeyEvent;
+using protocol::TextEvent;
using protocol::MouseEvent;
// A class to generate events on Mac.
@@ -51,6 +52,7 @@ class InputInjectorMac : public InputInjector {
// InputStub interface.
virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
+ virtual void InjectTextEvent(const TextEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
// InputInjector interface.
@@ -68,6 +70,7 @@ class InputInjectorMac : public InputInjector {
// Mirrors the InputStub interface.
void InjectKeyEvent(const KeyEvent& event);
+ void InjectTextEvent(const TextEvent& event);
void InjectMouseEvent(const MouseEvent& event);
// Mirrors the InputInjector interface.
@@ -111,6 +114,10 @@ void InputInjectorMac::InjectKeyEvent(const KeyEvent& event) {
core_->InjectKeyEvent(event);
}
+void InputInjectorMac::InjectTextEvent(const TextEvent& event) {
+ core_->InjectTextEvent(event);
+}
+
void InputInjectorMac::InjectMouseEvent(const MouseEvent& event) {
core_->InjectMouseEvent(event);
}
@@ -203,6 +210,10 @@ void InputInjectorMac::Core::InjectKeyEvent(const KeyEvent& event) {
}
}
+void InputInjectorMac::Core::InjectTextEvent(const TextEvent& event) {
+ NOTIMPLEMENTED();
+}
+
void InputInjectorMac::Core::InjectMouseEvent(const MouseEvent& event) {
if (event.has_x() && event.has_y()) {
// On multi-monitor systems (0,0) refers to the top-left of the "main"
@@ -305,8 +316,7 @@ void InputInjectorMac::Core::Stop() {
clipboard_->Stop();
}
-InputInjectorMac::Core::~Core() {
-}
+InputInjectorMac::Core::~Core() {}
} // namespace
diff --git a/remoting/host/input_injector_win.cc b/remoting/host/input_injector_win.cc
index ebdf8ef..03e4b7e 100644
--- a/remoting/host/input_injector_win.cc
+++ b/remoting/host/input_injector_win.cc
@@ -22,6 +22,7 @@ namespace {
using protocol::ClipboardEvent;
using protocol::KeyEvent;
+using protocol::TextEvent;
using protocol::MouseEvent;
// A class to generate events on Windows.
@@ -36,6 +37,7 @@ class InputInjectorWin : public InputInjector {
// InputStub interface.
virtual void InjectKeyEvent(const KeyEvent& event) OVERRIDE;
+ virtual void InjectTextEvent(const TextEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const MouseEvent& event) OVERRIDE;
// InputInjector interface.
@@ -54,6 +56,7 @@ class InputInjectorWin : public InputInjector {
// Mirrors the InputStub interface.
void InjectKeyEvent(const KeyEvent& event);
+ void InjectTextEvent(const TextEvent& event);
void InjectMouseEvent(const MouseEvent& event);
// Mirrors the InputInjector interface.
@@ -66,6 +69,7 @@ class InputInjectorWin : public InputInjector {
virtual ~Core();
void HandleKey(const KeyEvent& event);
+ void HandleText(const TextEvent& event);
void HandleMouse(const MouseEvent& event);
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
@@ -98,6 +102,10 @@ void InputInjectorWin::InjectKeyEvent(const KeyEvent& event) {
core_->InjectKeyEvent(event);
}
+void InputInjectorWin::InjectTextEvent(const TextEvent& event) {
+ core_->InjectTextEvent(event);
+}
+
void InputInjectorWin::InjectMouseEvent(const MouseEvent& event) {
core_->InjectMouseEvent(event);
}
@@ -136,6 +144,16 @@ void InputInjectorWin::Core::InjectKeyEvent(const KeyEvent& event) {
HandleKey(event);
}
+void InputInjectorWin::Core::InjectTextEvent(const TextEvent& event) {
+ if (!main_task_runner_->BelongsToCurrentThread()) {
+ main_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&Core::InjectTextEvent, this, event));
+ return;
+ }
+
+ HandleText(event);
+}
+
void InputInjectorWin::Core::InjectMouseEvent(const MouseEvent& event) {
if (!main_task_runner_->BelongsToCurrentThread()) {
main_task_runner_->PostTask(
@@ -208,6 +226,10 @@ void InputInjectorWin::Core::HandleKey(const KeyEvent& event) {
LOG_GETLASTERROR(ERROR) << "Failed to inject a key event";
}
+void InputInjectorWin::Core::HandleText(const TextEvent& event) {
+ NOTIMPLEMENTED();
+}
+
void InputInjectorWin::Core::HandleMouse(const MouseEvent& event) {
// Reset the system idle suspend timeout.
SetThreadExecutionState(ES_SYSTEM_REQUIRED);
diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc
index 5bea812..7e31688 100644
--- a/remoting/host/ipc_desktop_environment_unittest.cc
+++ b/remoting/host/ipc_desktop_environment_unittest.cc
@@ -337,7 +337,7 @@ DesktopEnvironment* IpcDesktopEnvironmentTest::CreateDesktopEnvironment() {
InputInjector* IpcDesktopEnvironmentTest::CreateInputInjector() {
EXPECT_TRUE(remote_input_injector_ == NULL);
- remote_input_injector_ = new MockInputInjector();
+ remote_input_injector_ = new testing::StrictMock<MockInputInjector>();
EXPECT_CALL(*remote_input_injector_, StartPtr(_));
return remote_input_injector_;
@@ -426,14 +426,6 @@ TEST_F(IpcDesktopEnvironmentTest, Basic) {
// Run the message loop until the desktop is attached.
setup_run_loop_->Run();
- // Input injector should receive no events.
- EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_))
- .Times(0);
-
// Stop the test.
DeleteDesktopEnvironment();
@@ -456,14 +448,6 @@ TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) {
// Run the message loop until the desktop is attached.
setup_run_loop_->Run();
- // Input injector should receive no events.
- EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_))
- .Times(0);
-
// Stop the test when the first frame is captured.
EXPECT_CALL(screen_capturer_callback_, OnCaptureCompleted(_))
.WillOnce(DoAll(
@@ -499,14 +483,6 @@ TEST_F(IpcDesktopEnvironmentTest, Reattach) {
CreateDesktopProcess();
setup_run_loop_->Run();
- // Input injector should receive no events.
- EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_))
- .Times(0);
-
// Stop the test.
DeleteDesktopEnvironment();
@@ -539,10 +515,6 @@ TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) {
.Times(1)
.WillOnce(Invoke(this,
&IpcDesktopEnvironmentTest::ReflectClipboardEvent));
- EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_))
- .Times(0);
// Send a clipboard event.
protocol::ClipboardEvent event;
@@ -570,14 +542,10 @@ TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) {
setup_run_loop_->Run();
// Expect a single key event.
- EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_))
- .Times(0);
EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_))
.Times(AtLeast(1))
.WillRepeatedly(InvokeWithoutArgs(
this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment));
- EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_))
- .Times(0);
// Send a key event.
protocol::KeyEvent event;
@@ -590,6 +558,36 @@ TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) {
main_run_loop_.Run();
}
+// Tests injection of text events.
+TEST_F(IpcDesktopEnvironmentTest, InjectTextEvent) {
+ scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+ new protocol::MockClipboardStub());
+ EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
+ .Times(0);
+
+ // Start the input injector and screen capturer.
+ input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>());
+ video_capturer_->Start(&screen_capturer_callback_);
+
+ // Run the message loop until the desktop is attached.
+ setup_run_loop_->Run();
+
+ // Expect a single text event.
+ EXPECT_CALL(*remote_input_injector_, InjectTextEvent(_))
+ .Times(AtLeast(1))
+ .WillRepeatedly(InvokeWithoutArgs(
+ this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment));
+
+ // Send a text event.
+ protocol::TextEvent event;
+ event.set_text("hello");
+ input_injector_->InjectTextEvent(event);
+
+ task_runner_ = NULL;
+ io_task_runner_ = NULL;
+ main_run_loop_.Run();
+}
+
// Tests injection of mouse events.
TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) {
scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
@@ -605,10 +603,6 @@ TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) {
setup_run_loop_->Run();
// Expect a single mouse event.
- EXPECT_CALL(*remote_input_injector_, InjectClipboardEvent(_))
- .Times(0);
- EXPECT_CALL(*remote_input_injector_, InjectKeyEvent(_))
- .Times(0);
EXPECT_CALL(*remote_input_injector_, InjectMouseEvent(_))
.Times(1)
.WillOnce(InvokeWithoutArgs(
diff --git a/remoting/host/ipc_input_injector.cc b/remoting/host/ipc_input_injector.cc
index 7e63a4e..fd347e7 100644
--- a/remoting/host/ipc_input_injector.cc
+++ b/remoting/host/ipc_input_injector.cc
@@ -25,6 +25,10 @@ void IpcInputInjector::InjectKeyEvent(const protocol::KeyEvent& event) {
desktop_session_proxy_->InjectKeyEvent(event);
}
+void IpcInputInjector::InjectTextEvent(const protocol::TextEvent& event) {
+ desktop_session_proxy_->InjectTextEvent(event);
+}
+
void IpcInputInjector::InjectMouseEvent(const protocol::MouseEvent& event) {
desktop_session_proxy_->InjectMouseEvent(event);
}
diff --git a/remoting/host/ipc_input_injector.h b/remoting/host/ipc_input_injector.h
index 1bfdd3c..9174ca3 100644
--- a/remoting/host/ipc_input_injector.h
+++ b/remoting/host/ipc_input_injector.h
@@ -27,6 +27,7 @@ class IpcInputInjector : public InputInjector {
// InputStub interface.
virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
+ virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
// InputInjector interface.
diff --git a/remoting/host/remote_input_filter.cc b/remoting/host/remote_input_filter.cc
index 73e9898..2b28334 100644
--- a/remoting/host/remote_input_filter.cc
+++ b/remoting/host/remote_input_filter.cc
@@ -75,6 +75,12 @@ void RemoteInputFilter::InjectKeyEvent(const protocol::KeyEvent& event) {
event_tracker_->InjectKeyEvent(event);
}
+void RemoteInputFilter::InjectTextEvent(const protocol::TextEvent& event) {
+ if (ShouldIgnoreInput())
+ return;
+ event_tracker_->InjectTextEvent(event);
+}
+
void RemoteInputFilter::InjectMouseEvent(const protocol::MouseEvent& event) {
if (ShouldIgnoreInput())
return;
diff --git a/remoting/host/remote_input_filter.h b/remoting/host/remote_input_filter.h
index 20b5db6..0c26af6 100644
--- a/remoting/host/remote_input_filter.h
+++ b/remoting/host/remote_input_filter.h
@@ -34,6 +34,7 @@ class RemoteInputFilter : public protocol::InputStub {
// InputStub overrides.
virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
+ virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
private:
diff --git a/remoting/host/win/session_input_injector.cc b/remoting/host/win/session_input_injector.cc
index 8f7a366..2c4ee23 100644
--- a/remoting/host/win/session_input_injector.cc
+++ b/remoting/host/win/session_input_injector.cc
@@ -40,8 +40,9 @@ bool CheckCtrlAndAltArePressed(const std::set<uint32>& pressed_keys) {
namespace remoting {
using protocol::ClipboardEvent;
-using protocol::MouseEvent;
using protocol::KeyEvent;
+using protocol::MouseEvent;
+using protocol::TextEvent;
class SessionInputInjectorWin::Core
: public base::RefCountedThreadSafe<SessionInputInjectorWin::Core>,
@@ -63,6 +64,7 @@ class SessionInputInjectorWin::Core
// protocol::InputStub implementation.
virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
+ virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
private:
@@ -165,6 +167,17 @@ void SessionInputInjectorWin::Core::InjectKeyEvent(const KeyEvent& event) {
nested_executor_->InjectKeyEvent(event);
}
+void SessionInputInjectorWin::Core::InjectTextEvent(const TextEvent& event) {
+ if (!input_task_runner_->BelongsToCurrentThread()) {
+ input_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&Core::InjectTextEvent, this, event));
+ return;
+ }
+
+ SwitchToInputDesktop();
+ nested_executor_->InjectTextEvent(event);
+}
+
void SessionInputInjectorWin::Core::InjectMouseEvent(const MouseEvent& event) {
if (!input_task_runner_->BelongsToCurrentThread()) {
input_task_runner_->PostTask(
@@ -217,6 +230,11 @@ void SessionInputInjectorWin::InjectKeyEvent(const protocol::KeyEvent& event) {
core_->InjectKeyEvent(event);
}
+void SessionInputInjectorWin::InjectTextEvent(
+ const protocol::TextEvent& event) {
+ core_->InjectTextEvent(event);
+}
+
void SessionInputInjectorWin::InjectMouseEvent(
const protocol::MouseEvent& event) {
core_->InjectMouseEvent(event);
diff --git a/remoting/host/win/session_input_injector.h b/remoting/host/win/session_input_injector.h
index 9fcff40..9c9443c 100644
--- a/remoting/host/win/session_input_injector.h
+++ b/remoting/host/win/session_input_injector.h
@@ -41,6 +41,7 @@ class SessionInputInjectorWin : public InputInjector {
// protocol::InputStub implementation.
virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
+ virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE;
virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
private: