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

Side by Side Diff: content/child/websocket_bridge.cc

Issue 2102993002: Fix WebSocket to set first party for cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update testRunner calls to setBlockThirdPartyCookies() Created 4 years, 5 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
« no previous file with comments | « content/child/websocket_bridge.h ('k') | content/common/websocket_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 if (!client_) 199 if (!client_)
200 return; 200 return;
201 201
202 client_->didStartClosingHandshake(this); 202 client_->didStartClosingHandshake(this);
203 // |this| can be deleted here. 203 // |this| can be deleted here.
204 } 204 }
205 205
206 void WebSocketBridge::connect(const WebURL& url, 206 void WebSocketBridge::connect(const WebURL& url,
207 const WebVector<WebString>& protocols, 207 const WebVector<WebString>& protocols,
208 const WebSecurityOrigin& origin, 208 const WebSecurityOrigin& origin,
209 const WebURL& first_party_for_cookies,
209 const WebString& user_agent_override, 210 const WebString& user_agent_override,
210 WebSocketHandleClient* client) { 211 WebSocketHandleClient* client) {
211 DCHECK_EQ(kInvalidChannelId, channel_id_); 212 DCHECK_EQ(kInvalidChannelId, channel_id_);
212 WebSocketDispatcher* dispatcher = 213 WebSocketDispatcher* dispatcher =
213 ChildThreadImpl::current()->websocket_dispatcher(); 214 ChildThreadImpl::current()->websocket_dispatcher();
214 channel_id_ = dispatcher->AddBridge(this); 215 channel_id_ = dispatcher->AddBridge(this);
215 client_ = client; 216 client_ = client;
216 217
217 std::vector<std::string> protocols_to_pass; 218 std::vector<std::string> protocols_to_pass;
218 for (size_t i = 0; i < protocols.size(); ++i) 219 for (size_t i = 0; i < protocols.size(); ++i)
219 protocols_to_pass.push_back(protocols[i].utf8()); 220 protocols_to_pass.push_back(protocols[i].utf8());
220 221
221 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" << url << ", (" 222 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" << url << ", ("
222 << base::JoinString(protocols_to_pass, ", ") << "), " 223 << base::JoinString(protocols_to_pass, ", ") << "), "
223 << origin.toString().utf8() << ")"; 224 << origin.toString().utf8() << ")";
224 225
226 WebSocketHostMsg_AddChannelRequest_Params params;
227 params.socket_url = url;
228 params.requested_protocols = protocols_to_pass;
229 params.origin = origin;
230 params.first_party_for_cookies = first_party_for_cookies;
231 params.user_agent_override = user_agent_override.latin1();
232 params.render_frame_id = render_frame_id_;
233
225 // Headers (ie: User-Agent) are ISO Latin 1. 234 // Headers (ie: User-Agent) are ISO Latin 1.
226 ChildThreadImpl::current()->Send(new WebSocketHostMsg_AddChannelRequest( 235 ChildThreadImpl::current()->Send(new WebSocketHostMsg_AddChannelRequest(
227 channel_id_, url, protocols_to_pass, origin, 236 channel_id_, params));
228 user_agent_override.latin1(), render_frame_id_));
229 } 237 }
230 238
231 void WebSocketBridge::send(bool fin, 239 void WebSocketBridge::send(bool fin,
232 WebSocketHandle::MessageType type, 240 WebSocketHandle::MessageType type,
233 const char* data, 241 const char* data,
234 size_t size) { 242 size_t size) {
235 if (channel_id_ == kInvalidChannelId) 243 if (channel_id_ == kInvalidChannelId)
236 return; 244 return;
237 245
238 WebSocketMessageType type_to_pass = WEB_SOCKET_MESSAGE_TYPE_CONTINUATION; 246 WebSocketMessageType type_to_pass = WEB_SOCKET_MESSAGE_TYPE_CONTINUATION;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 return; 295 return;
288 WebSocketDispatcher* dispatcher = 296 WebSocketDispatcher* dispatcher =
289 ChildThreadImpl::current()->websocket_dispatcher(); 297 ChildThreadImpl::current()->websocket_dispatcher();
290 dispatcher->RemoveBridge(channel_id_); 298 dispatcher->RemoveBridge(channel_id_);
291 299
292 channel_id_ = kInvalidChannelId; 300 channel_id_ = kInvalidChannelId;
293 client_ = NULL; 301 client_ = NULL;
294 } 302 }
295 303
296 } // namespace content 304 } // namespace content
OLDNEW
« no previous file with comments | « content/child/websocket_bridge.h ('k') | content/common/websocket_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698