OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gnubby_auth_handler_posix.h" | 5 #include "remoting/host/gnubby_auth_handler_posix.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 request.SetString(kMessageType, kDataMessage); | 167 request.SetString(kMessageType, kDataMessage); |
168 request.SetInteger(kConnectionId, connection_id); | 168 request.SetInteger(kConnectionId, connection_id); |
169 | 169 |
170 base::ListValue* bytes = new base::ListValue(); | 170 base::ListValue* bytes = new base::ListValue(); |
171 for (std::string::const_iterator i = data.begin(); i != data.end(); ++i) { | 171 for (std::string::const_iterator i = data.begin(); i != data.end(); ++i) { |
172 bytes->AppendInteger(static_cast<unsigned char>(*i)); | 172 bytes->AppendInteger(static_cast<unsigned char>(*i)); |
173 } | 173 } |
174 request.Set(kDataPayload, bytes); | 174 request.Set(kDataPayload, bytes); |
175 | 175 |
176 std::string request_json; | 176 std::string request_json; |
177 if (!base::JSONWriter::Write(&request, &request_json)) { | 177 if (!base::JSONWriter::Write(request, &request_json)) { |
178 LOG(ERROR) << "Failed to create request json"; | 178 LOG(ERROR) << "Failed to create request json"; |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 protocol::ExtensionMessage message; | 182 protocol::ExtensionMessage message; |
183 message.set_type(kGnubbyAuthMessage); | 183 message.set_type(kGnubbyAuthMessage); |
184 message.set_data(request_json); | 184 message.set_data(request_json); |
185 | 185 |
186 client_stub_->DeliverHostMessage(message); | 186 client_stub_->DeliverHostMessage(message); |
187 } | 187 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } | 298 } |
299 | 299 |
300 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) { | 300 void GnubbyAuthHandlerPosix::RequestTimedOut(int connection_id) { |
301 HOST_LOG << "Gnubby request timed out"; | 301 HOST_LOG << "Gnubby request timed out"; |
302 ActiveSockets::iterator iter = active_sockets_.find(connection_id); | 302 ActiveSockets::iterator iter = active_sockets_.find(connection_id); |
303 if (iter != active_sockets_.end()) | 303 if (iter != active_sockets_.end()) |
304 SendErrorAndCloseActiveSocket(iter); | 304 SendErrorAndCloseActiveSocket(iter); |
305 } | 305 } |
306 | 306 |
307 } // namespace remoting | 307 } // namespace remoting |
OLD | NEW |