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

Unified Diff: content/browser/websockets/websocket_handshake_request_info_impl.cc

Issue 2397393002: Provide child/frame IDs for WebSocket handshake request (Closed)
Patch Set: fix Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/websockets/websocket_handshake_request_info_impl.cc
diff --git a/content/browser/websockets/websocket_handshake_request_info_impl.cc b/content/browser/websockets/websocket_handshake_request_info_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..59fb2e27c5f3c1254ce1f32447bfcfe12334291f
--- /dev/null
+++ b/content/browser/websockets/websocket_handshake_request_info_impl.cc
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/websockets/websocket_handshake_request_info_impl.h"
+
+#include "net/url_request/url_request.h"
+
+namespace content {
+
+namespace {
+
+constexpr int g_tag = 0;
+
+} // namesapce
+
+WebSocketHandshakeRequestInfoImpl::WebSocketHandshakeRequestInfoImpl(
+ int child_id,
+ int frame_id)
+ : child_id_(child_id), frame_id_(frame_id) {}
+
+WebSocketHandshakeRequestInfoImpl::~WebSocketHandshakeRequestInfoImpl() {}
+
+void WebSocketHandshakeRequestInfoImpl::CreateInfoAndAssociateWithRequest(
+ int child_id,
+ int frame_id,
+ net::URLRequest* request) {
+ request->SetUserData(
+ &g_tag, new WebSocketHandshakeRequestInfoImpl(child_id, frame_id));
+}
+
+int WebSocketHandshakeRequestInfoImpl::GetChildId() const {
+ return child_id_;
+}
+
+int WebSocketHandshakeRequestInfoImpl::GetFrameId() const {
+ return frame_id_;
+}
+
+const WebSocketHandshakeRequestInfo* WebSocketHandshakeRequestInfo::ForRequest(
+ const net::URLRequest* request) {
+ return static_cast<WebSocketHandshakeRequestInfoImpl*>(
+ request->GetUserData(&g_tag));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698