Make developerPrivate API available in stable.
[chromium-blink-merge.git] / content / common / socket_stream_handle_data.h
blobc339ec04cceb72dffe1f7285f3c65e6cbff4f102
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"
11 namespace WebKit {
12 class WebSocketStreamHandle;
15 namespace content {
17 // User data stored in each WebSocketStreamHandleImpl.
18 class SocketStreamHandleData : public base::SupportsUserData::Data {
19 public:
20 virtual ~SocketStreamHandleData() {}
22 int render_view_id() const { return render_view_id_; }
24 // Creates SocketStreamHandleData object with |render_view_id| and store it
25 // to |handle|.
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);
34 private:
35 explicit SocketStreamHandleData(int render_view_id)
36 : render_view_id_(render_view_id) {
39 int render_view_id_;
41 DISALLOW_COPY_AND_ASSIGN(SocketStreamHandleData);
44 } // namespace content
46 #endif // CONTENT_RENDERER_SOCKET_STREAM_HANDLE_DATA_H_