| 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * API for host-list management. | 7 * API for host-list management. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
| 11 var remoting = remoting || {}; | 11 var remoting = remoting || {}; |
| 12 | 12 |
| 13 (function() { | 13 (function() { |
| 14 | 14 |
| 15 'use strict'; | 15 'use strict'; |
| 16 | 16 |
| 17 /** @interface */ | 17 /** @interface */ |
| 18 remoting.HostListApi = function() { | 18 remoting.HostListApi = function() { |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Registers a new host with the host registry service (either the | 22 * Registers a new host with the host registry service (either the |
| 23 * Chromoting registry or GCD). | 23 * Chromoting registry or GCD). |
| 24 * | 24 * |
| 25 * @param {string} newHostId The ID of the new host to register. | |
| 26 * @param {string} hostName The user-visible name of the new host. | 25 * @param {string} hostName The user-visible name of the new host. |
| 27 * @param {string} publicKey The public half of the host's key pair. | 26 * @param {string} publicKey The public half of the host's key pair. |
| 28 * @param {string} hostClientId The OAuth2 client ID of the host. | 27 * @param {string} hostClientId The OAuth2 client ID of the host. |
| 29 * @return {!Promise<remoting.HostListApi.RegisterResult>} | 28 * @return {!Promise<remoting.HostListApi.RegisterResult>} |
| 30 */ | 29 */ |
| 31 remoting.HostListApi.prototype.register = function( | 30 remoting.HostListApi.prototype.register = function( |
| 32 newHostId, hostName, publicKey, hostClientId) { | 31 hostName, publicKey, hostClientId) { |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 /** | 34 /** |
| 36 * Fetch the list of hosts for a user. | 35 * Fetch the list of hosts for a user. |
| 37 * | 36 * |
| 38 * @return {!Promise<!Array<!remoting.Host>>} | 37 * @return {!Promise<!Array<!remoting.Host>>} |
| 39 */ | 38 */ |
| 40 remoting.HostListApi.prototype.get = function() { | 39 remoting.HostListApi.prototype.get = function() { |
| 41 }; | 40 }; |
| 42 | 41 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 * @param {remoting.HostListApi} newInstance | 92 * @param {remoting.HostListApi} newInstance |
| 94 */ | 93 */ |
| 95 remoting.HostListApi.setInstance = function(newInstance) { | 94 remoting.HostListApi.setInstance = function(newInstance) { |
| 96 instance = newInstance; | 95 instance = newInstance; |
| 97 }; | 96 }; |
| 98 | 97 |
| 99 })(); | 98 })(); |
| 100 | 99 |
| 101 /** | 100 /** |
| 102 * Information returned from the registry/GCD server when registering | 101 * Information returned from the registry/GCD server when registering |
| 103 * a device. GCD will fill in all three fields; the Chromoting | 102 * a device. |
| 104 * registry will only return an auth code; other fields will be empty. | |
| 105 * | 103 * |
| 106 * The fields are: | 104 * The fields are: |
| 107 * | 105 * |
| 108 * authCode: An OAuth2 authorization code that can be exchanged for a | 106 * authCode: An OAuth2 authorization code that can be exchanged for a |
| 109 * refresh token. | 107 * refresh token. |
| 110 * | 108 * |
| 111 * email: The email/XMPP address of the robot account associated | 109 * email: The email/XMPP address of the robot account associated with |
| 112 * with this device. | 110 * this device. The Chromoting directory sets this field to the |
| 111 * empty string; GCD returns a real email address. |
| 113 * | 112 * |
| 114 * gcmId: The ID string assigned to this device by GCD. | 113 * hostId: The ID of the newly registered host. |
| 114 * |
| 115 * isLegacy: True for registrations in the legacy directory, false for |
| 116 * registrations in GCD. |
| 115 * | 117 * |
| 116 * @typedef {{ | 118 * @typedef {{ |
| 117 * authCode: string, | 119 * authCode: string, |
| 118 * email: string, | 120 * email: string, |
| 119 * gcdId: string | 121 * hostId: string, |
| 122 * isLegacy: boolean |
| 120 * }} | 123 * }} |
| 121 */ | 124 */ |
| 122 remoting.HostListApi.RegisterResult; | 125 remoting.HostListApi.RegisterResult; |
| OLD | NEW |