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

Side by Side Diff: content/child/websocket_bridge.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/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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 WebSocketHandleClient* client) { 207 WebSocketHandleClient* client) {
208 DCHECK_EQ(kInvalidChannelId, channel_id_); 208 DCHECK_EQ(kInvalidChannelId, channel_id_);
209 WebSocketDispatcher* dispatcher = 209 WebSocketDispatcher* dispatcher =
210 ChildThread::current()->websocket_dispatcher(); 210 ChildThread::current()->websocket_dispatcher();
211 channel_id_ = dispatcher->AddBridge(this); 211 channel_id_ = dispatcher->AddBridge(this);
212 client_ = client; 212 client_ = client;
213 213
214 std::vector<std::string> protocols_to_pass; 214 std::vector<std::string> protocols_to_pass;
215 for (size_t i = 0; i < protocols.size(); ++i) 215 for (size_t i = 0; i < protocols.size(); ++i)
216 protocols_to_pass.push_back(protocols[i].utf8()); 216 protocols_to_pass.push_back(protocols[i].utf8());
217 GURL origin_to_pass(origin.utf8()); 217 SerializedOrigin origin_to_pass(origin);
218 218
219 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" 219 DVLOG(1) << "Bridge#" << channel_id_ << " Connect(" << url << ", ("
220 << url << ", (" << JoinString(protocols_to_pass, ", ") << "), " 220 << JoinString(protocols_to_pass, ", ") << "), "
221 << origin_to_pass << ")"; 221 << origin_to_pass.string << ")";
222 222
223 ChildThread::current()->Send( 223 ChildThread::current()->Send(
224 new WebSocketHostMsg_AddChannelRequest(channel_id_, 224 new WebSocketHostMsg_AddChannelRequest(channel_id_,
225 url, 225 url,
226 protocols_to_pass, 226 protocols_to_pass,
227 origin_to_pass)); 227 origin_to_pass));
228 } 228 }
229 229
230 void WebSocketBridge::send(bool fin, 230 void WebSocketBridge::send(bool fin,
231 WebSocketHandle::MessageType type, 231 WebSocketHandle::MessageType type,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return; 286 return;
287 WebSocketDispatcher* dispatcher = 287 WebSocketDispatcher* dispatcher =
288 ChildThread::current()->websocket_dispatcher(); 288 ChildThread::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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698