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/browser/renderer_host/websocket_host.h" | 5 #include "content/browser/renderer_host/websocket_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "content/browser/renderer_host/websocket_dispatcher_host.h" | 9 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
10 #include "content/common/websocket_messages.h" | 10 #include "content/common/websocket_messages.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 DVLOG(1) << "WebSocketHost: created routing_id=" << routing_id; | 236 DVLOG(1) << "WebSocketHost: created routing_id=" << routing_id; |
237 | 237 |
238 scoped_ptr<net::WebSocketEventInterface> event_interface( | 238 scoped_ptr<net::WebSocketEventInterface> event_interface( |
239 new WebSocketEventHandler(dispatcher, routing_id)); | 239 new WebSocketEventHandler(dispatcher, routing_id)); |
240 channel_.reset( | 240 channel_.reset( |
241 new net::WebSocketChannel(event_interface.Pass(), url_request_context)); | 241 new net::WebSocketChannel(event_interface.Pass(), url_request_context)); |
242 } | 242 } |
243 | 243 |
244 WebSocketHost::~WebSocketHost() {} | 244 WebSocketHost::~WebSocketHost() {} |
245 | 245 |
246 bool WebSocketHost::OnMessageReceived(const IPC::Message& message, | 246 bool WebSocketHost::OnMessageReceived(const IPC::Message& message) { |
247 bool* message_was_ok) { | |
248 bool handled = true; | 247 bool handled = true; |
249 IPC_BEGIN_MESSAGE_MAP_EX(WebSocketHost, message, *message_was_ok) | 248 IPC_BEGIN_MESSAGE_MAP(WebSocketHost, message) |
250 IPC_MESSAGE_HANDLER(WebSocketHostMsg_AddChannelRequest, OnAddChannelRequest) | 249 IPC_MESSAGE_HANDLER(WebSocketHostMsg_AddChannelRequest, OnAddChannelRequest) |
251 IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, OnSendFrame) | 250 IPC_MESSAGE_HANDLER(WebSocketMsg_SendFrame, OnSendFrame) |
252 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, OnFlowControl) | 251 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, OnFlowControl) |
253 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, OnDropChannel) | 252 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, OnDropChannel) |
254 IPC_MESSAGE_UNHANDLED(handled = false) | 253 IPC_MESSAGE_UNHANDLED(handled = false) |
255 IPC_END_MESSAGE_MAP_EX() | 254 IPC_END_MESSAGE_MAP() |
256 return handled; | 255 return handled; |
257 } | 256 } |
258 | 257 |
259 void WebSocketHost::OnAddChannelRequest( | 258 void WebSocketHost::OnAddChannelRequest( |
260 const GURL& socket_url, | 259 const GURL& socket_url, |
261 const std::vector<std::string>& requested_protocols, | 260 const std::vector<std::string>& requested_protocols, |
262 const url::Origin& origin) { | 261 const url::Origin& origin) { |
263 DVLOG(3) << "WebSocketHost::OnAddChannelRequest" | 262 DVLOG(3) << "WebSocketHost::OnAddChannelRequest" |
264 << " routing_id=" << routing_id_ << " socket_url=\"" << socket_url | 263 << " routing_id=" << routing_id_ << " socket_url=\"" << socket_url |
265 << "\" requested_protocols=\"" | 264 << "\" requested_protocols=\"" |
(...skipping 26 matching lines...) Expand all Loading... |
292 const std::string& reason) { | 291 const std::string& reason) { |
293 DVLOG(3) << "WebSocketHost::OnDropChannel" | 292 DVLOG(3) << "WebSocketHost::OnDropChannel" |
294 << " routing_id=" << routing_id_ << " was_clean=" << was_clean | 293 << " routing_id=" << routing_id_ << " was_clean=" << was_clean |
295 << " code=" << code << " reason=\"" << reason << "\""; | 294 << " code=" << code << " reason=\"" << reason << "\""; |
296 | 295 |
297 // TODO(yhirano): Handle |was_clean| appropriately. | 296 // TODO(yhirano): Handle |was_clean| appropriately. |
298 channel_->StartClosingHandshake(code, reason); | 297 channel_->StartClosingHandshake(code, reason); |
299 } | 298 } |
300 | 299 |
301 } // namespace content | 300 } // namespace content |
OLD | NEW |