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

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

Issue 10332138: WebSocket Pepper API: allow to close connection without code and reason (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uint16_t -> enum Created 8 years, 7 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
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_WEBSOCKET_H_ 5 #ifndef PPAPI_CPP_WEBSOCKET_H_
6 #define PPAPI_CPP_WEBSOCKET_H_ 6 #define PPAPI_CPP_WEBSOCKET_H_
7 7
8 #include "ppapi/c/ppb_websocket.h" 8 #include "ppapi/c/ppb_websocket.h"
9 #include "ppapi/cpp/resource.h" 9 #include "ppapi/cpp/resource.h"
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 /// <code>PP_ERROR_NOACCESS</code> corresponds to a SecurityError of the 63 /// <code>PP_ERROR_NOACCESS</code> corresponds to a SecurityError of the
64 /// specification. 64 /// specification.
65 /// Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to 65 /// Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to
66 /// Connect(). 66 /// Connect().
67 int32_t Connect(const Var& url, const Var protocols[], 67 int32_t Connect(const Var& url, const Var protocols[],
68 uint32_t protocol_count, const CompletionCallback& callback); 68 uint32_t protocol_count, const CompletionCallback& callback);
69 69
70 /// Close() closes the specified WebSocket connection by specifying 70 /// Close() closes the specified WebSocket connection by specifying
71 /// <code>code</code> and <code>reason</code>. 71 /// <code>code</code> and <code>reason</code>.
72 /// 72 ///
73 /// @param[in] code The WebSocket close code. This is ignored if it is 0. 73 /// @param[in] code The WebSocket close code. This is ignored if it is
74 /// <code>PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED</code>.
74 /// <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the 75 /// <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the
75 /// usual case. To indicate some specific error cases, codes in the range 76 /// usual case. To indicate some specific error cases, codes in the range
76 /// <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to 77 /// <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to
77 /// <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range 78 /// <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range
78 /// <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to 79 /// <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to
79 /// <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. 80 /// <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available.
80 /// 81 ///
81 /// @param[in] reason A <code>Var</code> of string type representing the 82 /// @param[in] reason A <code>Var</code> of string type representing the
82 /// close reason. This is ignored if it is an undefined type. 83 /// close reason. This is ignored if it is an undefined type.
83 /// 84 ///
84 /// @param[in] callback A <code>CompletionCallback</code> called when the 85 /// @param[in] callback A <code>CompletionCallback</code> called when the
85 /// connection is closed or an error occurs in closing the connection. 86 /// connection is closed or an error occurs in closing the connection.
86 /// 87 ///
87 /// @return An int32_t containing an error code from 88 /// @return An int32_t containing an error code from
88 /// <code>pp_errors.h</code>. 89 /// <code>pp_errors.h</code>.
89 /// Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains 90 /// Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains
90 /// an invalid character as a UTF-8 string, or is longer than 123 bytes. 91 /// an invalid character as a UTF-8 string, or is longer than 123 bytes.
91 /// <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript 92 /// <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript
92 /// SyntaxError in the WebSocket API specification. 93 /// SyntaxError in the WebSocket API specification.
93 /// Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer 94 /// Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer
94 /// equal to 1000 or in the range 3000 to 4999. 95 /// equal to 1000 or in the range 3000 to 4999.
95 /// <code>PP_ERROR_NOACCESS</code> corresponds to an InvalidAccessError in 96 /// <code>PP_ERROR_NOACCESS</code> corresponds to an InvalidAccessError in
96 /// the WebSocket API specification. Returns <code>PP_ERROR_INPROGRESS</code> 97 /// the WebSocket API specification. Returns <code>PP_ERROR_INPROGRESS</code>
97 /// if a previous call to Close() is not finished. 98 /// if a previous call to Close() is not finished.
98 int32_t Close(uint16_t code, const Var& reason, 99 int32_t Close(PP_WebSocketStatusCode code, const Var& reason,
99 const CompletionCallback& callback); 100 const CompletionCallback& callback);
100 101
101 /// ReceiveMessage() receives a message from the WebSocket server. 102 /// ReceiveMessage() receives a message from the WebSocket server.
102 /// This interface only returns a single message. That is, this interface 103 /// This interface only returns a single message. That is, this interface
103 /// must be called at least N times to receive N messages, no matter the size 104 /// must be called at least N times to receive N messages, no matter the size
104 /// of each message. 105 /// of each message.
105 /// 106 ///
106 /// @param[out] message The received message is copied to provided 107 /// @param[out] message The received message is copied to provided
107 /// <code>message</code>. The <code>message</code> must remain valid until 108 /// <code>message</code>. The <code>message</code> must remain valid until
108 /// ReceiveMessage() completes. Its received <code>Var</code> will be of 109 /// ReceiveMessage() completes. Its received <code>Var</code> will be of
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 /// @return Returns a <code>Var</code> of string type. If called before the 205 /// @return Returns a <code>Var</code> of string type. If called before the
205 /// connection is established, the <code>Var</code> contains the empty 206 /// connection is established, the <code>Var</code> contains the empty
206 /// string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if this function 207 /// string. Returns a <code>PP_VARTYPE_UNDEFINED</code> if this function
207 /// is called on an invalid resource. 208 /// is called on an invalid resource.
208 Var GetURL(); 209 Var GetURL();
209 }; 210 };
210 211
211 } // namespace pp 212 } // namespace pp
212 213
213 #endif // PPAPI_CPP_WEBSOCKET_H_ 214 #endif // PPAPI_CPP_WEBSOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698