| 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 // Use the <code>chrome.copresence</code> API to communicate with other nearby | 5 // Use the <code>chrome.copresence</code> API to communicate with other nearby |
| 6 // devices using Google's copresence service. | 6 // devices using Google's copresence service. |
| 7 namespace copresence { | 7 namespace copresence { |
| 8 // Suggestions to copresence on how to do the publication and subscription. | 8 // Suggestions to copresence on how to do the publication and subscription. |
| 9 // Note: These are only suggestions. Actual behavior may not always match | 9 // Note: These are only suggestions. Actual behavior may not always match |
| 10 // what is requested. | 10 // what is requested. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 // Callback to return the status of a completed batchExecute() call. | 116 // Callback to return the status of a completed batchExecute() call. |
| 117 callback ExecuteCallback = void(ExecuteStatus status); | 117 callback ExecuteCallback = void(ExecuteStatus status); |
| 118 | 118 |
| 119 interface Functions { | 119 interface Functions { |
| 120 // Sets the API key to use with the app. This parameter only needs to be | 120 // Sets the API key to use with the app. This parameter only needs to be |
| 121 // set to communicate with apps on other platforms. Once the API key is set, | 121 // set to communicate with apps on other platforms. Once the API key is set, |
| 122 // apps on any platform that are using this API key can publish/subscribe to | 122 // apps on any platform that are using this API key can publish/subscribe to |
| 123 // each other. | 123 // each other. |
| 124 [nodoc] static void setApiKey(DOMString apiKey); | 124 [nodoc] static void setApiKey(DOMString apiKey); |
| 125 |
| 126 // Temporary call to enable authenticated copresence |
| 127 // with an externally provided OAuth token. |
| 128 // TODO(ckehoe): Replace this with a proper API. |
| 129 [nodoc] static void setAuthToken(DOMString token); |
| 125 | 130 |
| 126 // Executes a set of copresence operations in one batch. They will either | 131 // Executes a set of copresence operations in one batch. They will either |
| 127 // all be executed, or none will be executed (due to an error in one or | 132 // all be executed, or none will be executed (due to an error in one or |
| 128 // more of them). Publish/Subscribe operations are executed in the order | 133 // more of them). Publish/Subscribe operations are executed in the order |
| 129 // that they exist in the array. Unpublish and Unsubscribe are processsed | 134 // that they exist in the array. Unpublish and Unsubscribe are processsed |
| 130 // at the end, again, in the order that they exist in the array. | 135 // at the end, again, in the order that they exist in the array. |
| 131 static void execute(Operation[] operations, ExecuteCallback callback); | 136 static void execute(Operation[] operations, ExecuteCallback callback); |
| 132 }; | 137 }; |
| 133 | 138 |
| 134 interface Events { | 139 interface Events { |
| 135 // Fired when new messages arrive. | 140 // Fired when new messages arrive. |
| 136 static void onMessagesReceived(DOMString subscriptionId, | 141 static void onMessagesReceived(DOMString subscriptionId, |
| 137 Message[] messages); | 142 Message[] messages); |
| 138 | 143 |
| 139 // Fired when a new copresence status update is available. | 144 // Fired when a new copresence status update is available. |
| 140 static void onStatusUpdated(Status status); | 145 static void onStatusUpdated(Status status); |
| 141 }; | 146 }; |
| 142 }; | 147 }; |
| 143 | 148 |
| OLD | NEW |