Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: chrome/browser/resources/md_user_manager/profile_api.js

Issue 1630903002: material design user manager with create profile flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed the comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 cr.define('cr.ui', function() {
tommycli 2016/02/03 01:13:22 This and all of the JS should be compiled. See the
Moe 2016/02/05 17:58:39 Done.
7 /**
8 * API that encapsulates messaging between JS and C++ for user-manager page.
9 */
10 function ProfileApi() {}
11
12 ProfileApi.getAvailableIconsCallback_ = null;
tommycli 2016/02/03 01:13:22 Need annotations
Moe 2016/02/05 17:58:39 Done.
13 ProfileApi.getSignedInUsersCallback = null;
14 ProfileApi.profileCreateErrorCallback_ = null;
15 ProfileApi.profileCreateWarningCallback_ = null;
16 ProfileApi.profileCreateSuccessCallback_ = null;
17
18 ProfileApi.setProfileCreateSuccessCallback = function(callback) {
19 ProfileApi.profileCreateSuccessCallback_ = callback;
20 };
21
22 ProfileApi.setProfileCreateWarningCallback = function(callback) {
23 ProfileApi.profileCreateWarningCallback_ = callback;
24 };
25
26 ProfileApi.setProfileCreateErrorCallback = function(callback) {
27 ProfileApi.profileCreateErrorCallback_ = callback;
28 };
29
30 /**
31 * Called from JavaScript. Gets the available profile icons to choose from.
32 */
33 ProfileApi.getAvailableIcons = function(callback) {
34 ProfileApi.getAvailableIconsCallback_ = callback;
35 chrome.send('requestDefaultProfileIcons');
36 };
37
38 /**
39 * Called from JavaScript. Gets the current signed-in users.
40 */
41 ProfileApi.getSignedInUsers = function(callback) {
42 ProfileApi.getSignedInUsersCallback = callback;
43 chrome.send('requestSignedInProfiles');
44 };
45
46 /**
47 * Called from C++ as a response to getAvailableIcons.
48 */
49 ProfileApi.updateAvailableIcons = function(iconUrls) {
50 if (ProfileApi.getAvailableIconsCallback_)
51 ProfileApi.getAvailableIconsCallback_(iconUrls);
52 };
53
54 /**
55 * Called from C++ in response to 'requestSignedInProfiles'.
56 */
57 ProfileApi.updateSignedInUsers = function(signedIn_users) {
58 if (ProfileApi.getSignedInUsersCallback)
59 ProfileApi.getSignedInUsersCallback(signedIn_users);
60 };
61
62 /**
63 * Called from C++ to report supervised user import errors.
64 */
65 ProfileApi.onSupervisedUserImportError_ = function(error) {};
66
67 /**
68 * Called from C++ to report successful importing of a supervised user to
69 */
70 ProfileApi.onSupervisedUserImportSuccess_ = function() {};
71
72 /**
73 * Called from C++ to report supervised user create errors.
74 */
75 ProfileApi.onCreateProfileError = function(error) {
76 if (ProfileApi.profileCreateErrorCallback_)
77 ProfileApi.profileCreateErrorCallback_(error);
78 };
79
80 /**
81 * Called from C++ to report supervised user create warnings.
82 */
83 ProfileApi.onCreateProfileWarning = function(warning) {
84 if (ProfileApi.profileCreateWarningCallback_)
85 ProfileApi.profileCreateWarningCallback_(warning);
86 };
87
88 /**
89 * Called from C++ to report successful creation of a user.
90 * @param {Object}:
91 * profileInfo = {
92 * name: 'Profile Name',
93 * filePath: '/path/to/profile/data/on/disk'
94 * isSupervised: (true|false),
95 * };
96 * @private
97 */
98 ProfileApi.onCreateProfileSuccess = function(profileInfo) {
99 if (ProfileApi.profileCreateSuccessCallback_)
100 ProfileApi.profileCreateSuccessCallback_(profileInfo);
101 };
102
103 return {
104 ProfileApi: ProfileApi,
105 };
106 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698