Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: content/browser/renderer_host/websocket_host.cc

Issue 170843007: Introduce url::Origin to represent Web Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/serialized_origin.h"
10 #include "content/common/websocket_messages.h" 11 #include "content/common/websocket_messages.h"
11 #include "ipc/ipc_message_macros.h" 12 #include "ipc/ipc_message_macros.h"
12 #include "net/http/http_request_headers.h" 13 #include "net/http/http_request_headers.h"
13 #include "net/http/http_response_headers.h" 14 #include "net/http/http_response_headers.h"
14 #include "net/websockets/websocket_channel.h" 15 #include "net/websockets/websocket_channel.h"
15 #include "net/websockets/websocket_event_interface.h" 16 #include "net/websockets/websocket_event_interface.h"
16 #include "net/websockets/websocket_frame.h" // for WebSocketFrameHeader::OpCode 17 #include "net/websockets/websocket_frame.h" // for WebSocketFrameHeader::OpCode
17 #include "net/websockets/websocket_handshake_request_info.h" 18 #include "net/websockets/websocket_handshake_request_info.h"
18 #include "net/websockets/websocket_handshake_response_info.h" 19 #include "net/websockets/websocket_handshake_response_info.h"
19 20
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, OnFlowControl) 225 IPC_MESSAGE_HANDLER(WebSocketMsg_FlowControl, OnFlowControl)
225 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, OnDropChannel) 226 IPC_MESSAGE_HANDLER(WebSocketMsg_DropChannel, OnDropChannel)
226 IPC_MESSAGE_UNHANDLED(handled = false) 227 IPC_MESSAGE_UNHANDLED(handled = false)
227 IPC_END_MESSAGE_MAP_EX() 228 IPC_END_MESSAGE_MAP_EX()
228 return handled; 229 return handled;
229 } 230 }
230 231
231 void WebSocketHost::OnAddChannelRequest( 232 void WebSocketHost::OnAddChannelRequest(
232 const GURL& socket_url, 233 const GURL& socket_url,
233 const std::vector<std::string>& requested_protocols, 234 const std::vector<std::string>& requested_protocols,
234 const GURL& origin) { 235 const SerializedOrigin& origin) {
235 DVLOG(3) << "WebSocketHost::OnAddChannelRequest" 236 DVLOG(3) << "WebSocketHost::OnAddChannelRequest"
236 << " routing_id=" << routing_id_ << " socket_url=\"" << socket_url 237 << " routing_id=" << routing_id_ << " socket_url=\"" << socket_url
237 << "\" requested_protocols=\"" 238 << "\" requested_protocols=\""
238 << JoinString(requested_protocols, ", ") << "\" origin=\"" << origin 239 << JoinString(requested_protocols, ", ") << "\" origin=\""
239 << "\""; 240 << origin.string << "\"";
240 241
241 channel_->SendAddChannelRequest(socket_url, requested_protocols, origin); 242 channel_->SendAddChannelRequest(
243 socket_url, requested_protocols, origin.string);
242 } 244 }
243 245
244 void WebSocketHost::OnSendFrame(bool fin, 246 void WebSocketHost::OnSendFrame(bool fin,
245 WebSocketMessageType type, 247 WebSocketMessageType type,
246 const std::vector<char>& data) { 248 const std::vector<char>& data) {
247 DVLOG(3) << "WebSocketHost::OnSendFrame" 249 DVLOG(3) << "WebSocketHost::OnSendFrame"
248 << " routing_id=" << routing_id_ << " fin=" << fin 250 << " routing_id=" << routing_id_ << " fin=" << fin
249 << " type=" << type << " data is " << data.size() << " bytes"; 251 << " type=" << type << " data is " << data.size() << " bytes";
250 252
251 channel_->SendFrame(fin, MessageTypeToOpCode(type), data); 253 channel_->SendFrame(fin, MessageTypeToOpCode(type), data);
(...skipping 11 matching lines...) Expand all
263 const std::string& reason) { 265 const std::string& reason) {
264 DVLOG(3) << "WebSocketHost::OnDropChannel" 266 DVLOG(3) << "WebSocketHost::OnDropChannel"
265 << " routing_id=" << routing_id_ << " was_clean=" << was_clean 267 << " routing_id=" << routing_id_ << " was_clean=" << was_clean
266 << " code=" << code << " reason=\"" << reason << "\""; 268 << " code=" << code << " reason=\"" << reason << "\"";
267 269
268 // TODO(yhirano): Handle |was_clean| appropriately. 270 // TODO(yhirano): Handle |was_clean| appropriately.
269 channel_->StartClosingHandshake(code, reason); 271 channel_->StartClosingHandshake(code, reason);
270 } 272 }
271 273
272 } // namespace content 274 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698