Chromium Code Reviews| 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 'create-profile' is a page that contains controls for creating | 6 * @fileoverview 'create-profile' is a page that contains controls for creating |
| 7 * a (optionally supervised) profile, including choosing a name, and an avatar. | 7 * a (optionally supervised) profile, including choosing a name, and an avatar. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @typedef {{url: string, label:string}} */ | 10 /** @typedef {{url: string, label:string}} */ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 /** | 83 /** |
| 84 * The current error/warning message. | 84 * The current error/warning message. |
| 85 * @private {string} | 85 * @private {string} |
| 86 */ | 86 */ |
| 87 message_: { | 87 message_: { |
| 88 type: String, | 88 type: String, |
| 89 value: '' | 89 value: '' |
| 90 }, | 90 }, |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * if true, a desktop shortcut will be created for the new profile. | |
| 94 * @private {boolean} | |
| 95 */ | |
| 96 createShortcut_: { | |
| 97 type: Boolean, | |
| 98 value: false | |
|
tommycli
2016/11/15 01:59:50
Can you double check on Windows whether it is inde
Moe
2016/11/15 16:03:10
You're right. It has to be true by default.
| |
| 99 }, | |
| 100 | |
| 101 /** | |
| 93 * True if the new profile is a supervised profile. | 102 * True if the new profile is a supervised profile. |
| 94 * @private {boolean} | 103 * @private {boolean} |
| 95 */ | 104 */ |
| 96 isSupervised_: { | 105 isSupervised_: { |
| 97 type: Boolean, | 106 type: Boolean, |
| 98 value: false | 107 value: false |
| 99 }, | 108 }, |
| 100 | 109 |
| 101 /** | 110 /** |
| 102 * The list of usernames and profile paths for currently signed-in users. | 111 * The list of usernames and profile paths for currently signed-in users. |
| 103 * @private {!Array<!SignedInUser>} | 112 * @private {!Array<!SignedInUser>} |
| 104 */ | 113 */ |
| 105 signedInUsers_: { | 114 signedInUsers_: { |
| 106 type: Array, | 115 type: Array, |
| 107 value: function() { return []; } | 116 value: function() { return []; } |
| 108 }, | 117 }, |
| 109 | 118 |
| 110 /** | 119 /** |
| 111 * Index of the selected signed-in user. | 120 * Index of the selected signed-in user. |
| 112 * @private {number} | 121 * @private {number} |
| 113 */ | 122 */ |
| 114 signedInUserIndex_: { | 123 signedInUserIndex_: { |
| 115 type: Number, | 124 type: Number, |
| 116 value: NO_USER_SELECTED | 125 value: NO_USER_SELECTED |
| 117 }, | 126 }, |
| 118 | 127 |
| 119 /** @private {!signin.ProfileBrowserProxy} */ | 128 /** @private {!signin.ProfileBrowserProxy} */ |
| 120 browserProxy_: Object | 129 browserProxy_: Object, |
| 130 | |
| 131 /** | |
| 132 * True if the profile shortcuts feature is enabled. | |
| 133 * @private | |
| 134 */ | |
| 135 isProfileShortcutsEnabled_: { | |
| 136 type: Boolean, | |
| 137 value: function() { | |
| 138 return loadTimeData.getBoolean('profileShortcutsEnabled'); | |
| 139 }, | |
| 140 readOnly: true | |
| 141 } | |
| 121 }, | 142 }, |
| 122 | 143 |
| 123 listeners: { | 144 listeners: { |
| 124 'tap': 'onTap_', | 145 'tap': 'onTap_', |
| 125 'importUserPopup.import': 'onImportUserPopupImport_' | 146 'importUserPopup.import': 'onImportUserPopupImport_' |
| 126 }, | 147 }, |
| 127 | 148 |
| 128 /** @override */ | 149 /** @override */ |
| 129 created: function() { | 150 created: function() { |
| 130 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); | 151 this.browserProxy_ = signin.ProfileBrowserProxyImpl.getInstance(); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 */ | 369 */ |
| 349 createProfile_: function() { | 370 createProfile_: function() { |
| 350 var custodianProfilePath = ''; | 371 var custodianProfilePath = ''; |
| 351 if (this.signedInUserIndex_ != NO_USER_SELECTED) { | 372 if (this.signedInUserIndex_ != NO_USER_SELECTED) { |
| 352 custodianProfilePath = | 373 custodianProfilePath = |
| 353 this.signedInUser_(this.signedInUserIndex_).profilePath; | 374 this.signedInUser_(this.signedInUserIndex_).profilePath; |
| 354 } | 375 } |
| 355 this.hideMessage_(); | 376 this.hideMessage_(); |
| 356 this.createInProgress_ = true; | 377 this.createInProgress_ = true; |
| 357 this.browserProxy_.createProfile( | 378 this.browserProxy_.createProfile( |
| 358 this.profileName_, this.profileIconUrl_, this.isSupervised_, '', | 379 this.profileName_, this.profileIconUrl_, this.createShortcut_, |
| 359 custodianProfilePath); | 380 this.isSupervised_, '', custodianProfilePath); |
| 360 }, | 381 }, |
| 361 | 382 |
| 362 /** | 383 /** |
| 363 * Handler for the 'import' event fired by #importUserPopup once a supervised | 384 * Handler for the 'import' event fired by #importUserPopup once a supervised |
| 364 * user is selected to be imported and the popup closes. | 385 * user is selected to be imported and the popup closes. |
| 365 * @param {!{detail: {supervisedUser: !SupervisedUser, | 386 * @param {!{detail: {supervisedUser: !SupervisedUser, |
| 366 * signedInUser: !SignedInUser}}} event | 387 * signedInUser: !SignedInUser}}} event |
| 367 * @private | 388 * @private |
| 368 */ | 389 */ |
| 369 onImportUserPopupImport_: function(event) { | 390 onImportUserPopupImport_: function(event) { |
| 370 var supervisedUser = event.detail.supervisedUser; | 391 var supervisedUser = event.detail.supervisedUser; |
| 371 var signedInUser = event.detail.signedInUser; | 392 var signedInUser = event.detail.signedInUser; |
| 372 this.hideMessage_(); | 393 this.hideMessage_(); |
| 373 this.createInProgress_ = true; | 394 this.createInProgress_ = true; |
| 374 this.browserProxy_.createProfile( | 395 this.browserProxy_.createProfile( |
| 375 supervisedUser.name, supervisedUser.iconURL, true, supervisedUser.id, | 396 supervisedUser.name, supervisedUser.iconURL, false, true, |
|
tommycli
2016/11/15 01:59:50
Maybe inline comment the param names...
false /*
Moe
2016/11/15 16:03:10
Done.
| |
| 376 signedInUser.profilePath); | 397 supervisedUser.id, signedInUser.profilePath); |
| 377 }, | 398 }, |
| 378 | 399 |
| 379 /** | 400 /** |
| 380 * Handler for the 'Cancel' button tap event. | 401 * Handler for the 'Cancel' button tap event. |
| 381 * @param {!Event} event | 402 * @param {!Event} event |
| 382 * @private | 403 * @private |
| 383 */ | 404 */ |
| 384 onCancelTap_: function(event) { | 405 onCancelTap_: function(event) { |
| 385 if (this.createInProgress_) { | 406 if (this.createInProgress_) { |
| 386 this.createInProgress_ = false; | 407 this.createInProgress_ = false; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 * Computed binding that returns True if there are any signed-in users. | 529 * Computed binding that returns True if there are any signed-in users. |
| 509 * @param {!Array<!SignedInUser>} signedInUsers signed-in users. | 530 * @param {!Array<!SignedInUser>} signedInUsers signed-in users. |
| 510 * @return {boolean} | 531 * @return {boolean} |
| 511 * @private | 532 * @private |
| 512 */ | 533 */ |
| 513 isSignedIn_: function(signedInUsers) { | 534 isSignedIn_: function(signedInUsers) { |
| 514 return signedInUsers.length > 0; | 535 return signedInUsers.length > 0; |
| 515 } | 536 } |
| 516 }); | 537 }); |
| 517 }()); | 538 }()); |
| OLD | NEW |