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

Unified Diff: remoting/host/security_key/security_key_message_handler.cc

Issue 2575963002: Handle Security Key requests from outside the remoted session correctly (Closed)
Patch Set: Addressing CR Feedback Created 4 years 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/security_key/security_key_message_handler.cc
diff --git a/remoting/host/security_key/security_key_message_handler.cc b/remoting/host/security_key/security_key_message_handler.cc
index 2c0948d58b25b746885498f38ce774e070417575..22712a672ea7b8a60b258b365be510c6b895fbb3 100644
--- a/remoting/host/security_key/security_key_message_handler.cc
+++ b/remoting/host/security_key/security_key_message_handler.cc
@@ -88,9 +88,18 @@ void SecurityKeyMessageHandler::HandleIpcConnectionChange(
SendMessageWithPayload(SecurityKeyMessageType::CONNECT_RESPONSE,
std::string(1, kConnectResponseActiveSession));
} else {
- SendMessageWithPayload(
- SecurityKeyMessageType::CONNECT_ERROR,
- "Unknown error occurred while establishing connection.");
+ SendMessageWithPayload(SecurityKeyMessageType::CONNECT_RESPONSE,
+ std::string(1, kConnectResponseNoSession));
+ // We expect the server to close the IPC channel in this scenario.
+ expect_ipc_channel_close_ = true;
+ }
+}
+
+void SecurityKeyMessageHandler::HandleIpcConnectionError() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ if (!expect_ipc_channel_close_) {
+ SendMessageWithPayload(SecurityKeyMessageType::CONNECT_ERROR,
+ "Unknown error occurred during connection.");
}
}
@@ -125,9 +134,9 @@ void SecurityKeyMessageHandler::HandleConnectRequest(
// If we find an IPC server, then attempt to establish a connection.
ipc_client_->EstablishIpcConnection(
base::Bind(&SecurityKeyMessageHandler::HandleIpcConnectionChange,
- base::Unretained(this), true),
- base::Bind(&SecurityKeyMessageHandler::HandleIpcConnectionChange,
- base::Unretained(this), false));
+ base::Unretained(this)),
+ base::Bind(&SecurityKeyMessageHandler::HandleIpcConnectionError,
+ base::Unretained(this)));
} else {
SendMessageWithPayload(SecurityKeyMessageType::CONNECT_RESPONSE,
std::string(1, kConnectResponseNoSession));

Powered by Google App Engine
This is Rietveld 408576698