| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 ChildThreadImpl::current()->websocket_dispatcher(); | 213 ChildThreadImpl::current()->websocket_dispatcher(); |
| 214 channel_id_ = dispatcher->AddBridge(this); | 214 channel_id_ = dispatcher->AddBridge(this); |
| 215 client_ = client; | 215 client_ = client; |
| 216 | 216 |
| 217 std::vector<std::string> protocols_to_pass; | 217 std::vector<std::string> protocols_to_pass; |
| 218 for (size_t i = 0; i < protocols.size(); ++i) | 218 for (size_t i = 0; i < protocols.size(); ++i) |
| 219 protocols_to_pass.push_back(protocols[i].utf8()); | 219 protocols_to_pass.push_back(protocols[i].utf8()); |
| 220 url::DeprecatedSerializedOrigin origin_to_pass(origin); | 220 url::DeprecatedSerializedOrigin origin_to_pass(origin); |
| 221 | 221 |
| 222 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" << url << ", (" | 222 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" << url << ", (" |
| 223 << base::JoinString(protocols_to_pass, ", ") << "), " | 223 << JoinString(protocols_to_pass, ", ") << "), " |
| 224 << origin_to_pass.string() << ")"; | 224 << origin_to_pass.string() << ")"; |
| 225 | 225 |
| 226 ChildThreadImpl::current()->Send(new WebSocketHostMsg_AddChannelRequest( | 226 ChildThreadImpl::current()->Send(new WebSocketHostMsg_AddChannelRequest( |
| 227 channel_id_, url, protocols_to_pass, origin_to_pass, render_frame_id_)); | 227 channel_id_, url, protocols_to_pass, origin_to_pass, render_frame_id_)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void WebSocketBridge::send(bool fin, | 230 void WebSocketBridge::send(bool fin, |
| 231 WebSocketHandle::MessageType type, | 231 WebSocketHandle::MessageType type, |
| 232 const char* data, | 232 const char* data, |
| 233 size_t size) { | 233 size_t size) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return; | 286 return; |
| 287 WebSocketDispatcher* dispatcher = | 287 WebSocketDispatcher* dispatcher = |
| 288 ChildThreadImpl::current()->websocket_dispatcher(); | 288 ChildThreadImpl::current()->websocket_dispatcher(); |
| 289 dispatcher->RemoveBridge(channel_id_); | 289 dispatcher->RemoveBridge(channel_id_); |
| 290 | 290 |
| 291 channel_id_ = kInvalidChannelId; | 291 channel_id_ = kInvalidChannelId; |
| 292 client_ = NULL; | 292 client_ = NULL; |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace content | 295 } // namespace content |
| OLD | NEW |