OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** @typedef {{username: string, profilePath: string}} */ |
| 6 var SignedInUser; |
| 7 |
| 8 /** @typedef {{name: string, filePath: string, isSupervised: boolean}} */ |
| 9 var ProfileInfo; |
| 10 |
| 11 cr.define('signin', function() { |
| 12 /** |
| 13 * API that encapsulates messaging between JS and C++ for creating/importing |
| 14 * profiles in the user-manager page. |
| 15 * @constructor |
| 16 */ |
| 17 function ProfileApi() {} |
| 18 |
| 19 /** |
| 20 * Called from JavaScript. Gets the available profile icons to choose from. |
| 21 */ |
| 22 ProfileApi.getAvailableIcons = function() { |
| 23 chrome.send('requestDefaultProfileIcons'); |
| 24 }; |
| 25 |
| 26 /** |
| 27 * Called from JavaScript. Gets the current signed-in users. |
| 28 */ |
| 29 ProfileApi.getSignedInUsers = function() { |
| 30 chrome.send('requestSignedInProfiles'); |
| 31 }; |
| 32 |
| 33 /** |
| 34 * Called from JavaScript. Launches the guest user. |
| 35 */ |
| 36 ProfileApi.launchGuestUser = function() { |
| 37 chrome.send('launchGuest'); |
| 38 }; |
| 39 |
| 40 /** |
| 41 * Called from JavaScript. Creates a profile. |
| 42 * @param {string} profileName Name of the new profile. |
| 43 * @param {string} profileIconUrl URL of the selected icon of the new profile. |
| 44 * @param {boolean} isSupervised True if the new profile is supervised. |
| 45 * @param {string|undefined} supervisorProfilePath Profile path of the |
| 46 * supervisor if the new profile is supervised. |
| 47 */ |
| 48 ProfileApi.createProfile = function(profileName, profileIconUrl, isSupervised, |
| 49 supervisorProfilePath) { |
| 50 chrome.send('createProfile', |
| 51 [profileName, profileIconUrl, false, isSupervised, '', |
| 52 supervisorProfilePath]); |
| 53 }; |
| 54 |
| 55 /** |
| 56 * Called from JavaScript. Cancels creation of the new profile. |
| 57 */ |
| 58 ProfileApi.cancelCreateProfile = function() { |
| 59 chrome.send('cancelCreateProfile'); |
| 60 }; |
| 61 |
| 62 return { |
| 63 ProfileApi: ProfileApi, |
| 64 }; |
| 65 }); |
OLD | NEW |