OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/child/websocket_bridge.h" | 5 #include "content/child/websocket_bridge.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 std::vector<std::string> protocols_to_pass; | 221 std::vector<std::string> protocols_to_pass; |
222 for (size_t i = 0; i < protocols.size(); ++i) | 222 for (size_t i = 0; i < protocols.size(); ++i) |
223 protocols_to_pass.push_back(protocols[i].utf8()); | 223 protocols_to_pass.push_back(protocols[i].utf8()); |
224 url::Origin origin_to_pass(origin); | 224 url::Origin origin_to_pass(origin); |
225 | 225 |
226 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" << url << ", (" | 226 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" << url << ", (" |
227 << JoinString(protocols_to_pass, ", ") << "), " | 227 << JoinString(protocols_to_pass, ", ") << "), " |
228 << origin_to_pass.string() << ")"; | 228 << origin_to_pass.string() << ")"; |
229 | 229 |
230 ChildThread::current()->Send( | 230 ChildThread::current()->Send(new WebSocketHostMsg_AddChannelRequest( |
231 new WebSocketHostMsg_AddChannelRequest(channel_id_, | 231 channel_id_, url, protocols_to_pass, origin_to_pass, render_frame_id_)); |
232 url, | |
233 protocols_to_pass, | |
234 origin_to_pass)); | |
235 } | 232 } |
236 | 233 |
237 void WebSocketBridge::send(bool fin, | 234 void WebSocketBridge::send(bool fin, |
238 WebSocketHandle::MessageType type, | 235 WebSocketHandle::MessageType type, |
239 const char* data, | 236 const char* data, |
240 size_t size) { | 237 size_t size) { |
241 if (channel_id_ == kInvalidChannelId) | 238 if (channel_id_ == kInvalidChannelId) |
242 return; | 239 return; |
243 | 240 |
244 WebSocketMessageType type_to_pass = WEB_SOCKET_MESSAGE_TYPE_CONTINUATION; | 241 WebSocketMessageType type_to_pass = WEB_SOCKET_MESSAGE_TYPE_CONTINUATION; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 return; | 290 return; |
294 WebSocketDispatcher* dispatcher = | 291 WebSocketDispatcher* dispatcher = |
295 ChildThread::current()->websocket_dispatcher(); | 292 ChildThread::current()->websocket_dispatcher(); |
296 dispatcher->RemoveBridge(channel_id_); | 293 dispatcher->RemoveBridge(channel_id_); |
297 | 294 |
298 channel_id_ = kInvalidChannelId; | 295 channel_id_ = kInvalidChannelId; |
299 client_ = NULL; | 296 client_ = NULL; |
300 } | 297 } |
301 | 298 |
302 } // namespace content | 299 } // namespace content |
OLD | NEW |