1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_RENDERER_SOCKET_STREAM_HANDLE_DATA_H_
6 #define CONTENT_RENDERER_SOCKET_STREAM_HANDLE_DATA_H_
8 #include "base/supports_user_data.h"
9 #include "content_export.h"
12 class WebSocketStreamHandle
;
17 // User data stored in each WebSocketStreamHandleImpl.
18 class SocketStreamHandleData
: public base::SupportsUserData::Data
{
20 virtual ~SocketStreamHandleData() {}
22 int render_view_id() const { return render_view_id_
; }
24 // Creates SocketStreamHandleData object with |render_view_id| and store it
26 static void AddToHandle(
27 WebKit::WebSocketStreamHandle
* handle
, int render_view_id
);
29 // Retrieves the stored user data from WebKit::WebSocketStreamHandle object.
30 // |handle| must actually be a WebSocketStreamHandleImpl object.
31 CONTENT_EXPORT
static const SocketStreamHandleData
* ForHandle(
32 WebKit::WebSocketStreamHandle
* handle
);
35 explicit SocketStreamHandleData(int render_view_id
)
36 : render_view_id_(render_view_id
) {
41 DISALLOW_COPY_AND_ASSIGN(SocketStreamHandleData
);
44 } // namespace content
46 #endif // CONTENT_RENDERER_SOCKET_STREAM_HANDLE_DATA_H_