| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 Helper object and related behavior that encapsulate messaging | 6 * @fileoverview Helper object and related behavior that encapsulate messaging |
| 7 * between JS and C++ for creating/importing profiles in the user-manager page. | 7 * between JS and C++ for creating/importing profiles in the user-manager page. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @typedef {{username: string, profilePath: string}} */ | 10 /** @typedef {{username: string, profilePath: string}} */ |
| 11 var SignedInUser; | 11 var SignedInUser; |
| 12 | 12 |
| 13 /** @typedef {{name: string, filePath: string, isSupervised: boolean}} */ | 13 /** @typedef {{name: string, filePath: string, isSupervised: boolean}} */ |
| 14 var ProfileInfo; | 14 var ProfileInfo; |
| 15 | 15 |
| 16 /** @typedef {{id: string, |
| 17 * name: string, |
| 18 * iconURL: string, |
| 19 * onCurrentDevice: boolean}} |
| 20 */ |
| 21 var SupervisedUser; |
| 22 |
| 16 cr.define('signin', function() { | 23 cr.define('signin', function() { |
| 17 /** @interface */ | 24 /** @interface */ |
| 18 function ProfileBrowserProxy() {} | 25 function ProfileBrowserProxy() {} |
| 19 | 26 |
| 20 ProfileBrowserProxy.prototype = { | 27 ProfileBrowserProxy.prototype = { |
| 21 /** | 28 /** |
| 22 * Gets the available profile icons to choose from. | 29 * Gets the available profile icons to choose from. |
| 23 */ | 30 */ |
| 24 getAvailableIcons: function() { | 31 getAvailableIcons: function() { |
| 25 assertNotReached(); | 32 assertNotReached(); |
| 26 }, | 33 }, |
| 27 | 34 |
| 28 /** | 35 /** |
| 29 * Gets the current signed-in users. | 36 * Gets the current signed-in users. |
| 30 */ | 37 */ |
| 31 getSignedInUsers: function() { | 38 getSignedInUsers: function() { |
| 32 assertNotReached(); | 39 assertNotReached(); |
| 33 }, | 40 }, |
| 34 | 41 |
| 35 /** | 42 /** |
| 36 * Launches the guest user. | 43 * Launches the guest user. |
| 37 */ | 44 */ |
| 38 launchGuestUser: function() { | 45 launchGuestUser: function() { |
| 39 assertNotReached(); | 46 assertNotReached(); |
| 40 }, | 47 }, |
| 41 | 48 |
| 42 /** | 49 /** |
| 50 * Gets the list of existing supervised users. |
| 51 * @param {string} profilePath Profile Path of the custodian. |
| 52 * @return {Promise} A promise for the requested data. |
| 53 * @private |
| 54 */ |
| 55 getExistingSupervisedUsers: function(profilePath) { |
| 56 assertNotReached(); |
| 57 }, |
| 58 |
| 59 /** |
| 43 * Creates a profile. | 60 * Creates a profile. |
| 44 * @param {string} profileName Name of the new profile. | 61 * @param {string} profileName Name of the new profile. |
| 45 * @param {string} profileIconUrl URL of the selected icon of the new | 62 * @param {string} profileIconUrl URL of the selected icon of the new |
| 46 * profile. | 63 * profile. |
| 47 * @param {boolean} isSupervised True if the new profile is supervised. | 64 * @param {boolean} isSupervised True if the new profile is supervised. |
| 48 * @param {string|undefined} supervisorProfilePath Profile path of the | 65 * @param {string} custodianProfilePath Profile path of the custodian if |
| 49 * supervisor if the new profile is supervised. | 66 * the new profile is supervised. |
| 50 */ | 67 */ |
| 51 createProfile: function(profileName, profileIconUrl, isSupervised, | 68 createProfile: function(profileName, profileIconUrl, isSupervised, |
| 52 supervisorProfilePath) { | 69 custodianProfilePath) { |
| 53 assertNotReached(); | 70 assertNotReached(); |
| 54 }, | 71 }, |
| 55 | 72 |
| 56 /** | 73 /** |
| 57 * Cancels creation of the new profile. | 74 * Cancels creation of the new profile. |
| 58 */ | 75 */ |
| 59 cancelCreateProfile: function() { | 76 cancelCreateProfile: function() { |
| 60 assertNotReached(); | 77 assertNotReached(); |
| 61 }, | 78 }, |
| 62 | 79 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 getSignedInUsers: function() { | 114 getSignedInUsers: function() { |
| 98 chrome.send('requestSignedInProfiles'); | 115 chrome.send('requestSignedInProfiles'); |
| 99 }, | 116 }, |
| 100 | 117 |
| 101 /** @override */ | 118 /** @override */ |
| 102 launchGuestUser: function() { | 119 launchGuestUser: function() { |
| 103 chrome.send('launchGuest'); | 120 chrome.send('launchGuest'); |
| 104 }, | 121 }, |
| 105 | 122 |
| 106 /** @override */ | 123 /** @override */ |
| 124 getExistingSupervisedUsers: function(profilePath) { |
| 125 return cr.sendWithPromise('getExistingSupervisedUsers', profilePath); |
| 126 }, |
| 127 |
| 128 /** @override */ |
| 107 createProfile: function(profileName, profileIconUrl, isSupervised, | 129 createProfile: function(profileName, profileIconUrl, isSupervised, |
| 108 supervisorProfilePath) { | 130 custodianProfilePath) { |
| 109 chrome.send('createProfile', | 131 chrome.send('createProfile', |
| 110 [profileName, profileIconUrl, false, isSupervised, '', | 132 [profileName, profileIconUrl, false, isSupervised, '', |
| 111 supervisorProfilePath]); | 133 custodianProfilePath]); |
| 112 }, | 134 }, |
| 113 | 135 |
| 114 /** @override */ | 136 /** @override */ |
| 115 cancelCreateProfile: function() { | 137 cancelCreateProfile: function() { |
| 116 chrome.send('cancelCreateProfile'); | 138 chrome.send('cancelCreateProfile'); |
| 117 }, | 139 }, |
| 118 | 140 |
| 119 /** @override */ | 141 /** @override */ |
| 120 initializeUserManager: function(locationHash) { | 142 initializeUserManager: function(locationHash) { |
| 121 chrome.send('userManagerInitialize', [locationHash]); | 143 chrome.send('userManagerInitialize', [locationHash]); |
| 122 }, | 144 }, |
| 123 | 145 |
| 124 /** @override */ | 146 /** @override */ |
| 125 launchUser: function(profilePath) { | 147 launchUser: function(profilePath) { |
| 126 chrome.send('launchUser', [profilePath]); | 148 chrome.send('launchUser', [profilePath]); |
| 127 } | 149 } |
| 128 }; | 150 }; |
| 129 | 151 |
| 130 return { | 152 return { |
| 131 ProfileBrowserProxy: ProfileBrowserProxy, | 153 ProfileBrowserProxy: ProfileBrowserProxy, |
| 132 ProfileBrowserProxyImpl: ProfileBrowserProxyImpl, | 154 ProfileBrowserProxyImpl: ProfileBrowserProxyImpl, |
| 133 }; | 155 }; |
| 134 }); | 156 }); |
| OLD | NEW |