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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 // DEPRECATED: The URL to the receiver. This field will be removed in a | 83 // DEPRECATED: The URL to the receiver. This field will be removed in a |
84 // future release. | 84 // future release. |
85 DOMString url; | 85 DOMString url; |
86 | 86 |
87 // Connection information that was used to establish the channel to the | 87 // Connection information that was used to establish the channel to the |
88 // receiver. | 88 // receiver. |
89 ConnectInfo connectInfo; | 89 ConnectInfo connectInfo; |
90 | 90 |
91 // The current state of the channel. | 91 // The current state of the channel. |
92 ReadyState readyState; | 92 ReadyState readyState; |
93 | 93 |
94 // If set, the last error condition encountered by the channel. | 94 // If set, the last error condition encountered by the channel. |
95 ChannelError? errorState; | 95 ChannelError? errorState; |
96 }; | 96 }; |
97 | 97 |
98 // Describes a message sent or received over the channel. Currently only | 98 // Describes a message sent or received over the channel. Currently only |
99 // string messages are supported, although ArrayBuffer and Blob types may be | 99 // string messages are supported, although ArrayBuffer and Blob types may be |
100 // supported in the future. | 100 // supported in the future. |
101 dictionary MessageInfo { | 101 dictionary MessageInfo { |
102 // The message namespace. A namespace is a URN of the form | 102 // The message namespace. A namespace is a URN of the form |
103 // urn:cast-x:<namespace> that is used to interpret and route Cast messages. | 103 // urn:cast-x:<namespace> that is used to interpret and route Cast messages. |
104 DOMString namespace_; | 104 DOMString namespace_; |
105 | 105 |
106 // source and destination ids identify the origin and destination of the | 106 // source and destination ids identify the origin and destination of the |
107 // message. They are used to route messages between endpoints that share a | 107 // message. They are used to route messages between endpoints that share a |
108 // device-to-device channel. | 108 // device-to-device channel. |
109 // | 109 // |
110 // For messages between applications: | 110 // For messages between applications: |
111 // - The sender application id is a unique identifier generated on behalf | 111 // - The sender application id is a unique identifier generated on behalf |
112 // of the sender application. | 112 // of the sender application. |
113 // - The receiver id is always the the session id for the application. | 113 // - The receiver id is always the the session id for the application. |
114 // | 114 // |
115 // For messages to or from the sender or receiver platform, the special ids | 115 // For messages to or from the sender or receiver platform, the special ids |
116 // 'sender-0' and 'receiver-0' can be used. | 116 // 'sender-0' and 'receiver-0' can be used. |
117 // | 117 // |
118 // For messages intended for all endpoints using a given channel, the | 118 // For messages intended for all endpoints using a given channel, the |
119 // wildcard destination_id '*' can be used. | 119 // wildcard destination_id '*' can be used. |
120 DOMString sourceId; | 120 DOMString sourceId; |
121 DOMString destinationId; | 121 DOMString destinationId; |
122 | 122 |
123 // The content of the message. Must be either a string or an ArrayBuffer. | 123 // The content of the message. Must be either a string or an ArrayBuffer. |
124 any data; | 124 any data; |
125 }; | 125 }; |
126 | 126 |
127 // Describes a terminal error encountered by the channel with details of the | 127 // Describes a terminal error encountered by the channel with details of the |
(...skipping 22 matching lines...) Expand all Loading... | |
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. | 154 // Callback from <code>getLogs</code> method. |
155 // |log|: compressed serialized raw bytes containing the logs. | 155 // |log|: compressed serialized raw bytes containing the logs. |
156 // The log is formatted using protocol buffer. | 156 // The log is formatted using protocol buffer. |
157 // See extensions/browser/api/cast_channel/logging.proto for definition. | 157 // See extensions/browser/api/cast_channel/logging.proto for definition. |
158 // Compression is in gzip format. | 158 // Compression is in gzip format. |
159 callback GetLogsCallback = void (ArrayBuffer log); | 159 callback GetLogsCallback = void (ArrayBuffer log); |
160 | 160 |
161 interface Functions { | 161 interface Functions { |
162 // 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 |
163 // 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 |
164 // 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 |
165 // with a ChannelInfo with readyState == 'connecting'. If unsuccessful, the | 165 // with a ChannelInfo with readyState == 'connecting'. If unsuccessful, the |
166 // callback will be invoked with a ChannelInfo with channel.readyState == | 166 // callback will be invoked with a ChannelInfo with channel.readyState == |
167 // 'closed', channel.errorState will be set to the error condition, and | 167 // 'closed', channel.errorState will be set to the error condition, and |
168 // onError will be fired with error details. | 168 // onError will be fired with error details. |
169 // | 169 // |
170 // 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... | |
181 MessageInfo message, | 181 MessageInfo message, |
182 ChannelInfoCallback callback); | 182 ChannelInfoCallback callback); |
183 | 183 |
184 // Requests that the channel be closed and invokes callback with the | 184 // Requests that the channel be closed and invokes callback with the |
185 // resulting channel status. The channel must be in readyState == 'open' or | 185 // resulting channel status. The channel must be in readyState == 'open' or |
186 // 'connecting'. If successful, onClose will be fired with readyState == | 186 // 'connecting'. If successful, onClose will be fired with readyState == |
187 // 'closed'. If unsuccessful, channel.readyState will be set to 'closed', | 187 // 'closed'. If unsuccessful, channel.readyState will be set to 'closed', |
188 // and channel.errorState will be set to the error condition. | 188 // and channel.errorState will be set to the error condition. |
189 static void close(ChannelInfo channel, | 189 static void close(ChannelInfo channel, |
190 ChannelInfoCallback callback); | 190 ChannelInfoCallback callback); |
191 | 191 |
192 // Get logs in compressed serialized format. See GetLogsCallback for | 192 // Get logs in compressed serialized format. See GetLogsCallback for |
193 // details. | 193 // details. |
194 // |callback|: If successful, |callback| is invoked with data. Otherwise, | 194 // |callback|: If successful, |callback| is invoked with data. Otherwise, |
195 // an error will be raised. | 195 // an error will be raised. |
196 static void getLogs(GetLogsCallback callback); | 196 static void getLogs(GetLogsCallback callback); |
197 | |
198 // Sets intermediate certificate authority keys. | |
mark a. foltz
2014/10/03 20:07:12
What is the format of the inputs? We need to add
vadimgo
2014/10/03 20:42:36
Added a comment with the format, which is multiple
| |
199 static void setAuthorityKeys(DOMString signature, | |
200 DOMString keys); | |
mark a. foltz
2014/10/03 20:07:12
This should have a callback argument (even one tha
vadimgo
2014/10/03 20:42:36
Done.
| |
197 }; | 201 }; |
198 | 202 |
199 // Events on the channel. | 203 // Events on the channel. |
200 interface Events { | 204 interface Events { |
201 // Fired when a message is received on an open channel. | 205 // Fired when a message is received on an open channel. |
202 static void onMessage(ChannelInfo channel, | 206 static void onMessage(ChannelInfo channel, |
203 MessageInfo message); | 207 MessageInfo message); |
204 | 208 |
205 // Fired when an error occurs as a result of a channel operation or a | 209 // Fired when an error occurs as a result of a channel operation or a |
206 // network event. |error| contains details of the error. | 210 // network event. |error| contains details of the error. |
207 static void onError(ChannelInfo channel, ErrorInfo error); | 211 static void onError(ChannelInfo channel, ErrorInfo error); |
208 }; | 212 }; |
209 }; | 213 }; |
OLD | NEW |