OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/websockets/websocket_handshake_request_info_impl.h" |
| 6 |
| 7 #include "net/url_request/url_request.h" |
| 8 |
| 9 namespace content { |
| 10 |
| 11 namespace { |
| 12 |
| 13 constexpr int g_tag = 0; |
| 14 |
| 15 } // namesapce |
| 16 |
| 17 WebSocketHandshakeRequestInfoImpl::WebSocketHandshakeRequestInfoImpl( |
| 18 int child_id, |
| 19 int render_frame_id) |
| 20 : child_id_(child_id), render_frame_id_(render_frame_id) {} |
| 21 |
| 22 WebSocketHandshakeRequestInfoImpl::~WebSocketHandshakeRequestInfoImpl() {} |
| 23 |
| 24 void WebSocketHandshakeRequestInfoImpl::CreateInfoAndAssociateWithRequest( |
| 25 int child_id, |
| 26 int render_frame_id, |
| 27 net::URLRequest* request) { |
| 28 request->SetUserData( |
| 29 &g_tag, new WebSocketHandshakeRequestInfoImpl(child_id, render_frame_id)); |
| 30 } |
| 31 |
| 32 int WebSocketHandshakeRequestInfoImpl::GetChildId() const { |
| 33 return child_id_; |
| 34 } |
| 35 |
| 36 int WebSocketHandshakeRequestInfoImpl::GetRenderFrameId() const { |
| 37 return render_frame_id_; |
| 38 } |
| 39 |
| 40 const WebSocketHandshakeRequestInfo* WebSocketHandshakeRequestInfo::ForRequest( |
| 41 const net::URLRequest* request) { |
| 42 return static_cast<WebSocketHandshakeRequestInfoImpl*>( |
| 43 request->GetUserData(&g_tag)); |
| 44 } |
| 45 |
| 46 } // namespace content |
OLD | NEW |