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/gnubby_extension_session.h" | 5 #include "remoting/host/security_key/gnubby_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" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 DCHECK(client_stub_); | 65 DCHECK(client_stub_); |
66 | 66 |
67 gnubby_auth_handler_ = remoting::GnubbyAuthHandler::Create(base::Bind( | 67 gnubby_auth_handler_ = remoting::GnubbyAuthHandler::Create(base::Bind( |
68 &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this))); | 68 &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this))); |
69 } | 69 } |
70 | 70 |
71 GnubbyExtensionSession::~GnubbyExtensionSession() {} | 71 GnubbyExtensionSession::~GnubbyExtensionSession() {} |
72 | 72 |
73 // Returns true if the |message| is a Security Key ExtensionMessage. | 73 // Returns true if the |message| is a Security Key ExtensionMessage. |
74 // This is done so the host does not pass |message| to other HostExtensions. | 74 // This is done so the host does not pass |message| to other HostExtensions. |
75 // TODO(joedow): Use |client_session_control| to disconnect the session if we | 75 // TODO(joedow): Use |client_session_details| to disconnect the session if we |
76 // receive an invalid extension message. | 76 // receive an invalid extension message. |
77 bool GnubbyExtensionSession::OnExtensionMessage( | 77 bool GnubbyExtensionSession::OnExtensionMessage( |
78 ClientSessionControl* client_session_control, | 78 ClientSessionDetails* client_session_details, |
79 protocol::ClientStub* client_stub, | 79 protocol::ClientStub* client_stub, |
80 const protocol::ExtensionMessage& message) { | 80 const protocol::ExtensionMessage& message) { |
81 DCHECK(thread_checker_.CalledOnValidThread()); | 81 DCHECK(thread_checker_.CalledOnValidThread()); |
82 | 82 |
83 if (message.type() != kExtensionMessageType) { | 83 if (message.type() != kExtensionMessageType) { |
84 return false; | 84 return false; |
85 } | 85 } |
86 | 86 |
87 std::unique_ptr<base::Value> value = base::JSONReader::Read(message.data()); | 87 std::unique_ptr<base::Value> value = base::JSONReader::Read(message.data()); |
88 base::DictionaryValue* client_message; | 88 base::DictionaryValue* client_message; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void GnubbyExtensionSession::SetGnubbyAuthHandlerForTesting( | 198 void GnubbyExtensionSession::SetGnubbyAuthHandlerForTesting( |
199 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler) { | 199 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler) { |
200 DCHECK(gnubby_auth_handler); | 200 DCHECK(gnubby_auth_handler); |
201 | 201 |
202 gnubby_auth_handler_ = std::move(gnubby_auth_handler); | 202 gnubby_auth_handler_ = std::move(gnubby_auth_handler); |
203 gnubby_auth_handler_->SetSendMessageCallback(base::Bind( | 203 gnubby_auth_handler_->SetSendMessageCallback(base::Bind( |
204 &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this))); | 204 &GnubbyExtensionSession::SendMessageToClient, base::Unretained(this))); |
205 } | 205 } |
206 | 206 |
207 } // namespace remoting | 207 } // namespace remoting |
OLD | NEW |