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

Side by Side Diff: ppapi/cpp/websocket.h

Issue 9192009: WebSocket Pepper API: make the API out of dev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for land Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/dev/websocket_dev.h ('k') | ppapi/cpp/websocket.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #ifndef PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ 5 #ifndef PPAPI_CPP_WEBSOCKET_H_
6 #define PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ 6 #define PPAPI_CPP_WEBSOCKET_H_
7 7
8 #include "ppapi/c/dev/ppb_websocket_dev.h" 8 #include "ppapi/c/ppb_websocket.h"
9 #include "ppapi/cpp/resource.h" 9 #include "ppapi/cpp/resource.h"
10 10
11 /// @file 11 /// @file
12 /// This file defines the WebSocket_Dev interface. 12 /// This file defines the WebSocket interface.
13 13
14 namespace pp { 14 namespace pp {
15 15
16 class CompletionCallback; 16 class CompletionCallback;
17 class Instance; 17 class Instance;
18 class Var; 18 class Var;
19 19
20 /// The <code>WebSocket_Dev</code> class 20 /// The <code>WebSocket</code> class
21 class WebSocket_Dev : public Resource { 21 class WebSocket : public Resource {
22 public: 22 public:
23 /// Constructs a WebSocket_Dev object. 23 /// Constructs a WebSocket object.
24 WebSocket_Dev(Instance* instance); 24 WebSocket(Instance* instance);
25 25
26 /// Destructs a WebSocket_Dev object. 26 /// Destructs a WebSocket object.
27 virtual ~WebSocket_Dev(); 27 virtual ~WebSocket();
28 28
29 /// Connect() connects to the specified WebSocket server. Caller can call 29 /// Connect() connects to the specified WebSocket server. Caller can call
30 /// this method at most once. 30 /// this method at most once.
31 /// 31 ///
32 /// @param[in] url A <code>Var</code> of string type representing a WebSocket 32 /// @param[in] url A <code>Var</code> of string type representing a WebSocket
33 /// server URL. 33 /// server URL.
34 /// @param[in] protocols A pointer to an array of string type 34 /// @param[in] protocols A pointer to an array of string type
35 /// <code>Var</code> specifying sub-protocols. Each <code>Var</code> 35 /// <code>Var</code> specifying sub-protocols. Each <code>Var</code>
36 /// represents one sub-protocol. This argument can be null only if 36 /// represents one sub-protocol. This argument can be null only if
37 /// <code>protocol_count</code> is 0. 37 /// <code>protocol_count</code> is 0.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 /// Send() sends a message to the WebSocket server. 105 /// Send() sends a message to the WebSocket server.
106 /// 106 ///
107 /// @param[in] data A message to send. The message is copied to internal 107 /// @param[in] data A message to send. The message is copied to internal
108 /// buffer. So caller can free <code>data</code> safely after returning 108 /// buffer. So caller can free <code>data</code> safely after returning
109 /// from the function. It must be a <code>Var</code> of string or ArrayBuffer 109 /// from the function. It must be a <code>Var</code> of string or ArrayBuffer
110 /// types. 110 /// types.
111 /// 111 ///
112 /// @return An int32_t containing an error code from 112 /// @return An int32_t containing an error code from
113 /// <code>pp_errors.h</code>. 113 /// <code>pp_errors.h</code>.
114 /// Returns <code>PP_ERROR_FAILED</code> if the ReadyState is 114 /// Returns <code>PP_ERROR_FAILED</code> if the ReadyState is
115 /// <code>PP_WEBSOCKETREADYSTATE_CONNECTING_DEV</code>. It corresponds 115 /// <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code>. It corresponds JavaScript
116 /// JavaScript InvalidStateError of the specification. 116 /// InvalidStateError of the specification.
117 /// Returns <code>PP_ERROR_BADARGUMENT</code> if provided 117 /// Returns <code>PP_ERROR_BADARGUMENT</code> if provided
118 /// <code>message</code> of string type contains an invalid character as a 118 /// <code>message</code> of string type contains an invalid character as a
119 /// UTF-8 string. It corresponds to JavaScript SyntaxError of the 119 /// UTF-8 string. It corresponds to JavaScript SyntaxError of the
120 /// specification. 120 /// specification.
121 /// Otherwise, returns <code>PP_OK</code>, but it doesn't necessarily mean 121 /// Otherwise, returns <code>PP_OK</code>, but it doesn't necessarily mean
122 /// that the server received the message. 122 /// that the server received the message.
123 int32_t SendMessage(const Var& message); 123 int32_t SendMessage(const Var& message);
124 124
125 /// GetBufferedAmount() returns the number of bytes of text and binary 125 /// GetBufferedAmount() returns the number of bytes of text and binary
126 /// messages that have been queued for the WebSocket connection to send but 126 /// messages that have been queued for the WebSocket connection to send but
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 /// GetProtocol() returns the sub-protocol chosen by the server for the 162 /// GetProtocol() returns the sub-protocol chosen by the server for the
163 /// specified WebSocket connection. 163 /// specified WebSocket connection.
164 /// 164 ///
165 /// @return Returns a <code>Var</code> of string type. If called before the 165 /// @return Returns a <code>Var</code> of string type. If called before the
166 /// connection is established, it contains the empty string. 166 /// connection is established, it contains the empty string.
167 Var GetProtocol(); 167 Var GetProtocol();
168 168
169 /// GetReadyState() returns the ready state of the specified WebSocket 169 /// GetReadyState() returns the ready state of the specified WebSocket
170 /// connection. 170 /// connection.
171 /// 171 ///
172 /// @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID_DEV</code> if called 172 /// @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID</code> if called
173 /// before connect() is called. 173 /// before connect() is called.
174 PP_WebSocketReadyState_Dev GetReadyState(); 174 PP_WebSocketReadyState GetReadyState();
175 175
176 /// GetURL() returns the URL associated with specified WebSocket connection. 176 /// GetURL() returns the URL associated with specified WebSocket connection.
177 /// 177 ///
178 /// @return Returns a <code>Var</code> of string type. If called before the 178 /// @return Returns a <code>Var</code> of string type. If called before the
179 /// connection is established, it contains the empty string. 179 /// connection is established, it contains the empty string.
180 Var GetURL(); 180 Var GetURL();
181 }; 181 };
182 182
183 } // namespace pp 183 } // namespace pp
184 184
185 #endif // PPAPI_CPP_DEV_WEBSOCKET_DEV_H_ 185 #endif // PPAPI_CPP_WEBSOCKET_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/websocket_dev.h ('k') | ppapi/cpp/websocket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698