OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // API for communicating with a Google Cast device over an authenticated | 5 // API for communicating with a Google Cast device over an authenticated |
6 // channel. | 6 // channel. |
7 namespace cast.channel { | 7 namespace cast.channel { |
8 | 8 |
9 // The state of the channel. | 9 // The state of the channel. |
10 enum ReadyState { | 10 enum ReadyState { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // defined in net/base/net_error_list.h. | 144 // defined in net/base/net_error_list.h. |
145 long? netReturnValue; | 145 long? netReturnValue; |
146 | 146 |
147 // An error code returned by NSS. Values are defined in secerr.h. | 147 // An error code returned by NSS. Values are defined in secerr.h. |
148 long? nssErrorCode; | 148 long? nssErrorCode; |
149 }; | 149 }; |
150 | 150 |
151 // Callback holding the result of a channel operation. | 151 // Callback holding the result of a channel operation. |
152 callback ChannelInfoCallback = void (ChannelInfo result); | 152 callback ChannelInfoCallback = void (ChannelInfo result); |
153 | 153 |
| 154 // Callback from <code>getLogs</code> method. |
| 155 // |log|: compressed serialized raw bytes containing the logs. |
| 156 // The log is formatted using protocol buffer. |
| 157 // See extensions/browser/api/cast_channel/logging.proto for definition. |
| 158 // Compression is in gzip format. |
| 159 callback GetLogsCallback = void (ArrayBuffer log); |
| 160 |
154 interface Functions { | 161 interface Functions { |
155 // Opens a new channel to the Cast receiver specified by connectInfo. Only | 162 // Opens a new channel to the Cast receiver specified by connectInfo. Only |
156 // one channel may be connected to same receiver from the same extension at | 163 // one channel may be connected to same receiver from the same extension at |
157 // a time. If the open request is successful, the callback will be invoked | 164 // a time. If the open request is successful, the callback will be invoked |
158 // with a ChannelInfo with readyState == 'connecting'. If unsuccessful, the | 165 // with a ChannelInfo with readyState == 'connecting'. If unsuccessful, the |
159 // callback will be invoked with a ChannelInfo with channel.readyState == | 166 // callback will be invoked with a ChannelInfo with channel.readyState == |
160 // 'closed', channel.errorState will be set to the error condition, and | 167 // 'closed', channel.errorState will be set to the error condition, and |
161 // onError will be fired with error details. | 168 // onError will be fired with error details. |
162 // | 169 // |
163 // TODO(mfoltz): Convert 'any' to ConnectInfo once all clients are updated | 170 // TODO(mfoltz): Convert 'any' to ConnectInfo once all clients are updated |
(...skipping 10 matching lines...) Expand all Loading... |
174 MessageInfo message, | 181 MessageInfo message, |
175 ChannelInfoCallback callback); | 182 ChannelInfoCallback callback); |
176 | 183 |
177 // Requests that the channel be closed and invokes callback with the | 184 // Requests that the channel be closed and invokes callback with the |
178 // resulting channel status. The channel must be in readyState == 'open' or | 185 // resulting channel status. The channel must be in readyState == 'open' or |
179 // 'connecting'. If successful, onClose will be fired with readyState == | 186 // 'connecting'. If successful, onClose will be fired with readyState == |
180 // 'closed'. If unsuccessful, channel.readyState will be set to 'closed', | 187 // 'closed'. If unsuccessful, channel.readyState will be set to 'closed', |
181 // and channel.errorState will be set to the error condition. | 188 // and channel.errorState will be set to the error condition. |
182 static void close(ChannelInfo channel, | 189 static void close(ChannelInfo channel, |
183 ChannelInfoCallback callback); | 190 ChannelInfoCallback callback); |
| 191 |
| 192 // Get logs in compressed serialized format. See GetLogsCallback for |
| 193 // details. |
| 194 // |callback|: If successful, |callback| is invoked with data. Otherwise, |
| 195 // an error will be raised. |
| 196 static void getLogs(GetLogsCallback callback); |
184 }; | 197 }; |
185 | 198 |
186 // Events on the channel. | 199 // Events on the channel. |
187 interface Events { | 200 interface Events { |
188 // Fired when a message is received on an open channel. | 201 // Fired when a message is received on an open channel. |
189 static void onMessage(ChannelInfo channel, | 202 static void onMessage(ChannelInfo channel, |
190 MessageInfo message); | 203 MessageInfo message); |
191 | 204 |
192 // Fired when an error occurs as a result of a channel operation or a | 205 // Fired when an error occurs as a result of a channel operation or a |
193 // network event. |error| contains details of the error. | 206 // network event. |error| contains details of the error. |
194 static void onError(ChannelInfo channel, ErrorInfo error); | 207 static void onError(ChannelInfo channel, ErrorInfo error); |
195 }; | 208 }; |
196 }; | 209 }; |
OLD | NEW |