Index: chrome/browser/resources/md_user_manager/profile_api.js |
diff --git a/chrome/browser/resources/md_user_manager/profile_api.js b/chrome/browser/resources/md_user_manager/profile_api.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a40d70a3c9a6c9c7ca0a464dfe66a4615b0c1645 |
--- /dev/null |
+++ b/chrome/browser/resources/md_user_manager/profile_api.js |
@@ -0,0 +1,65 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+/** @typedef {{username: string, profilePath: string}} */ |
+var SignedInUser; |
+ |
+/** @typedef {{name: string, filePath: string, isSupervised: boolean}} */ |
+var ProfileInfo; |
+ |
+cr.define('signin', function() { |
+ /** |
+ * API that encapsulates messaging between JS and C++ for creating/importing |
+ * profiles in the user-manager page. |
+ * @constructor |
+ */ |
+ function ProfileApi() {} |
+ |
+ /** |
+ * Called from JavaScript. Gets the available profile icons to choose from. |
+ */ |
+ ProfileApi.getAvailableIcons = function() { |
+ chrome.send('requestDefaultProfileIcons'); |
+ }; |
+ |
+ /** |
+ * Called from JavaScript. Gets the current signed-in users. |
+ */ |
+ ProfileApi.getSignedInUsers = function() { |
+ chrome.send('requestSignedInProfiles'); |
+ }; |
+ |
+ /** |
+ * Called from JavaScript. Launches the guest user. |
+ */ |
+ ProfileApi.launchGuestUser = function() { |
+ chrome.send('launchGuest'); |
+ }; |
+ |
+ /** |
+ * Called from JavaScript. Creates a profile. |
+ * @param {string} profileName Name of the new profile. |
+ * @param {string} profileIconUrl URL of the selected icon of the new profile. |
+ * @param {boolean} isSupervised True if the new profile is supervised. |
+ * @param {string|undefined} supervisorProfilePath Profile path of the |
+ * supervisor if the new profile is supervised. |
+ */ |
+ ProfileApi.createProfile = function(profileName, profileIconUrl, isSupervised, |
+ supervisorProfilePath) { |
+ chrome.send('createProfile', |
+ [profileName, profileIconUrl, false, isSupervised, '', |
+ supervisorProfilePath]); |
+ }; |
+ |
+ /** |
+ * Called from JavaScript. Cancels creation of the new profile. |
+ */ |
+ ProfileApi.cancelCreateProfile = function() { |
+ chrome.send('cancelCreateProfile'); |
+ }; |
+ |
+ return { |
+ ProfileApi: ProfileApi, |
+ }; |
+}); |