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 /** |
| 6 * @fileoverview Helper object and related behavior that encapsulate messaging |
| 7 * between JS and C++ for creating/importing profiles in the user-manager page. |
| 8 */ |
| 9 |
| 10 /** @typedef {{username: string, profilePath: string}} */ |
| 11 var SignedInUser; |
| 12 |
| 13 /** @typedef {{name: string, filePath: string, isSupervised: boolean}} */ |
| 14 var ProfileInfo; |
| 15 |
| 16 cr.define('signin', function() { |
| 17 /** @interface */ |
| 18 function ProfileBrowserProxy() {} |
| 19 |
| 20 ProfileBrowserProxy.prototype = { |
| 21 /** |
| 22 * Gets the available profile icons to choose from. |
| 23 */ |
| 24 getAvailableIcons: function() { |
| 25 assertNotReached(); |
| 26 }, |
| 27 |
| 28 /** |
| 29 * Gets the current signed-in users. |
| 30 */ |
| 31 getSignedInUsers: function() { |
| 32 assertNotReached(); |
| 33 }, |
| 34 |
| 35 /** |
| 36 * Launches the guest user. |
| 37 */ |
| 38 launchGuestUser: function() { |
| 39 assertNotReached(); |
| 40 }, |
| 41 |
| 42 /** |
| 43 * Creates a profile. |
| 44 * @param {string} profileName Name of the new profile. |
| 45 * @param {string} profileIconUrl URL of the selected icon of the new |
| 46 * profile. |
| 47 * @param {boolean} isSupervised True if the new profile is supervised. |
| 48 * @param {string|undefined} supervisorProfilePath Profile path of the |
| 49 * supervisor if the new profile is supervised. |
| 50 */ |
| 51 createProfile: function(profileName, profileIconUrl, isSupervised, |
| 52 supervisorProfilePath) { |
| 53 assertNotReached(); |
| 54 }, |
| 55 |
| 56 /** |
| 57 * Cancels creation of the new profile. |
| 58 */ |
| 59 cancelCreateProfile: function() { |
| 60 assertNotReached(); |
| 61 }, |
| 62 |
| 63 /** |
| 64 * Initializes the UserManager |
| 65 * @param {string} locationHash |
| 66 */ |
| 67 initializeUserManager: function(locationHash) { |
| 68 assertNotReached(); |
| 69 }, |
| 70 |
| 71 /** |
| 72 * Launches the user with the given |profilePath| |
| 73 * @param {string} profilePath Profile Path of the user. |
| 74 */ |
| 75 launchUser: function(profilePath) { |
| 76 assertNotReached(); |
| 77 } |
| 78 }; |
| 79 |
| 80 /** |
| 81 * @constructor |
| 82 * @implements {signin.ProfileBrowserProxy} |
| 83 */ |
| 84 function ProfileBrowserProxyImpl() {} |
| 85 |
| 86 // The singleton instance_ is replaced with a test version of this wrapper |
| 87 // during testing. |
| 88 cr.addSingletonGetter(ProfileBrowserProxyImpl); |
| 89 |
| 90 ProfileBrowserProxyImpl.prototype = { |
| 91 /** @override */ |
| 92 getAvailableIcons: function() { |
| 93 chrome.send('requestDefaultProfileIcons'); |
| 94 }, |
| 95 |
| 96 /** @override */ |
| 97 getSignedInUsers: function() { |
| 98 chrome.send('requestSignedInProfiles'); |
| 99 }, |
| 100 |
| 101 /** @override */ |
| 102 launchGuestUser: function() { |
| 103 chrome.send('launchGuest'); |
| 104 }, |
| 105 |
| 106 /** @override */ |
| 107 createProfile: function(profileName, profileIconUrl, isSupervised, |
| 108 supervisorProfilePath) { |
| 109 chrome.send('createProfile', |
| 110 [profileName, profileIconUrl, false, isSupervised, '', |
| 111 supervisorProfilePath]); |
| 112 }, |
| 113 |
| 114 /** @override */ |
| 115 cancelCreateProfile: function() { |
| 116 chrome.send('cancelCreateProfile'); |
| 117 }, |
| 118 |
| 119 /** @override */ |
| 120 initializeUserManager: function(locationHash) { |
| 121 chrome.send('userManagerInitialize', [locationHash]); |
| 122 }, |
| 123 |
| 124 /** @override */ |
| 125 launchUser: function(profilePath) { |
| 126 chrome.send('launchUser', [profilePath]); |
| 127 } |
| 128 }; |
| 129 |
| 130 return { |
| 131 ProfileBrowserProxy: ProfileBrowserProxy, |
| 132 ProfileBrowserProxyImpl: ProfileBrowserProxyImpl, |
| 133 }; |
| 134 }); |
OLD | NEW |