| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/security_key/security_key_extension_session.h" | 5 #include "remoting/host/security_key/security_key_extension_session.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/single_thread_task_runner.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "remoting/base/logging.h" | 14 #include "remoting/base/logging.h" |
| 14 #include "remoting/host/client_session_details.h" | 15 #include "remoting/host/client_session_details.h" |
| 15 #include "remoting/host/security_key/security_key_auth_handler.h" | 16 #include "remoting/host/security_key/security_key_auth_handler.h" |
| 16 #include "remoting/proto/control.pb.h" | 17 #include "remoting/proto/control.pb.h" |
| 17 #include "remoting/protocol/client_stub.h" | 18 #include "remoting/protocol/client_stub.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // Used as the type attribute of all Security Key protocol::ExtensionMessages. | 22 // Used as the type attribute of all Security Key protocol::ExtensionMessages. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 56 } |
| 56 return true; | 57 return true; |
| 57 } | 58 } |
| 58 | 59 |
| 59 } // namespace | 60 } // namespace |
| 60 | 61 |
| 61 namespace remoting { | 62 namespace remoting { |
| 62 | 63 |
| 63 SecurityKeyExtensionSession::SecurityKeyExtensionSession( | 64 SecurityKeyExtensionSession::SecurityKeyExtensionSession( |
| 64 ClientSessionDetails* client_session_details, | 65 ClientSessionDetails* client_session_details, |
| 65 protocol::ClientStub* client_stub) | 66 protocol::ClientStub* client_stub, |
| 67 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) |
| 66 : client_stub_(client_stub) { | 68 : client_stub_(client_stub) { |
| 67 DCHECK(client_stub_); | 69 DCHECK(client_stub_); |
| 68 | 70 |
| 69 security_key_auth_handler_ = remoting::SecurityKeyAuthHandler::Create( | 71 security_key_auth_handler_ = remoting::SecurityKeyAuthHandler::Create( |
| 70 client_session_details, | 72 client_session_details, |
| 71 base::Bind(&SecurityKeyExtensionSession::SendMessageToClient, | 73 base::Bind(&SecurityKeyExtensionSession::SendMessageToClient, |
| 72 base::Unretained(this))); | 74 base::Unretained(this)), |
| 75 file_task_runner); |
| 73 } | 76 } |
| 74 | 77 |
| 75 SecurityKeyExtensionSession::~SecurityKeyExtensionSession() {} | 78 SecurityKeyExtensionSession::~SecurityKeyExtensionSession() {} |
| 76 | 79 |
| 77 // Returns true if the |message| is a Security Key ExtensionMessage. | 80 // Returns true if the |message| is a Security Key ExtensionMessage. |
| 78 // This is done so the host does not pass |message| to other HostExtensions. | 81 // This is done so the host does not pass |message| to other HostExtensions. |
| 79 // TODO(joedow): Use |client_session_details| to disconnect the session if we | 82 // TODO(joedow): Use |client_session_details| to disconnect the session if we |
| 80 // receive an invalid extension message. | 83 // receive an invalid extension message. |
| 81 bool SecurityKeyExtensionSession::OnExtensionMessage( | 84 bool SecurityKeyExtensionSession::OnExtensionMessage( |
| 82 ClientSessionDetails* client_session_details, | 85 ClientSessionDetails* client_session_details, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 std::unique_ptr<SecurityKeyAuthHandler> security_key_auth_handler) { | 206 std::unique_ptr<SecurityKeyAuthHandler> security_key_auth_handler) { |
| 204 DCHECK(security_key_auth_handler); | 207 DCHECK(security_key_auth_handler); |
| 205 | 208 |
| 206 security_key_auth_handler_ = std::move(security_key_auth_handler); | 209 security_key_auth_handler_ = std::move(security_key_auth_handler); |
| 207 security_key_auth_handler_->SetSendMessageCallback( | 210 security_key_auth_handler_->SetSendMessageCallback( |
| 208 base::Bind(&SecurityKeyExtensionSession::SendMessageToClient, | 211 base::Bind(&SecurityKeyExtensionSession::SendMessageToClient, |
| 209 base::Unretained(this))); | 212 base::Unretained(this))); |
| 210 } | 213 } |
| 211 | 214 |
| 212 } // namespace remoting | 215 } // namespace remoting |
| OLD | NEW |