Allow CRD clients to send a single mesage for keyboard combos
In order to invoke common platform tasks (send attention sequence
and lock workstation), CRD currently relies on injecting key events
on the client and picking them up on the host. There is a listener
which tracks the current key events and then calls the platform API
once it sees the trigger.
The problem with this approach is if there is a stuck key (i.e. we
fail to send a key up event) then this functionality is broken.
While we should fix bugs which cause lost key events, we should also
look for ways to prevent issues like that from affecting other
features.
My change allows the client to send a single message to invoke an
action like LockWorkstation() or SendSAS() which will then be
executed in the user's session. The change is targeted at the
Windows multi-process architecture but I've used interfaces to
allow for other platforms to use it (similar to how InputInjection
and the other event protos are used) if we decide to implement
it in the future.
This CL sets up the plumbing to get the request from the network
process to the desktop process on Windows. There will be a
follow-up CL which adds the WebRTC data channel and ClientSession
integration.
Bug: 892434
Change-Id: Iedfe8c4778fbaacacc68754c6d24e7fd485b0407
Reviewed-on: https://chromium-review.googlesource.com/c/1266100
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Jamie Walch <[email protected]>
Commit-Queue: Joe Downing <[email protected]>
Cr-Commit-Position: refs/heads/master@{#600463}
diff --git a/remoting/host/chromoting_param_traits.cc b/remoting/host/chromoting_param_traits.cc
index 10d759e..b4522b4 100644
--- a/remoting/host/chromoting_param_traits.cc
+++ b/remoting/host/chromoting_param_traits.cc
@@ -322,5 +322,34 @@
l->append(")");
}
+// static
+void ParamTraits<remoting::protocol::ActionRequest>::Write(
+ base::Pickle* m,
+ const param_type& p) {
+ std::string serialized_action_request;
+ bool result = p.SerializeToString(&serialized_action_request);
+ DCHECK(result);
+ m->WriteString(serialized_action_request);
+}
+
+// static
+bool ParamTraits<remoting::protocol::ActionRequest>::Read(
+ const base::Pickle* m,
+ base::PickleIterator* iter,
+ param_type* p) {
+ std::string serialized_action_request;
+ if (!iter->ReadString(&serialized_action_request))
+ return false;
+
+ return p->ParseFromString(serialized_action_request);
+}
+
+// static
+void ParamTraits<remoting::protocol::ActionRequest>::Log(const param_type& p,
+ std::string* l) {
+ l->append(base::StringPrintf("ActionRequest action: %d, id: %u", p.action(),
+ p.request_id()));
+}
+
} // namespace IPC