Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 var ArrayDataModel = cr.ui.ArrayDataModel; | 8 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 * Callback which receives the list of existing supervised users. Checks if | 364 * Callback which receives the list of existing supervised users. Checks if |
| 365 * the currently entered name is the name of an already existing supervised | 365 * the currently entered name is the name of an already existing supervised |
| 366 * user. If yes, the user is prompted to import the existing supervised | 366 * user. If yes, the user is prompted to import the existing supervised |
| 367 * user, and the create button is disabled. | 367 * user, and the create button is disabled. |
| 368 * If the received list is empty, hides the "import" link. | 368 * If the received list is empty, hides the "import" link. |
| 369 * @param {Array<Object>} supervisedUsers The list of existing supervised | 369 * @param {Array<Object>} supervisedUsers The list of existing supervised |
| 370 * users. | 370 * users. |
| 371 * @private | 371 * @private |
| 372 */ | 372 */ |
| 373 receiveExistingSupervisedUsers_: function(supervisedUsers) { | 373 receiveExistingSupervisedUsers_: function(supervisedUsers) { |
| 374 // During the creation of a SU, this gets called with a list including | |
| 375 // the just-created SU. Ignore, to prevent the "already exists" bubble | |
| 376 // from showing up if the overlay is already hidden. | |
|
Marc Treib
2016/01/07 17:04:15
nit: Now the comment doesn't really correspond to
atanasova
2016/01/07 17:08:40
Done.
| |
| 377 if (PageManager.getTopmostVisiblePage().pageDiv != this.pageDiv) | |
| 378 return; | |
| 374 $('import-existing-supervised-user-link').hidden = | 379 $('import-existing-supervised-user-link').hidden = |
| 375 supervisedUsers.length === 0; | 380 supervisedUsers.length === 0; |
| 376 if (!$('create-profile-supervised').checked) | 381 if (!$('create-profile-supervised').checked) |
| 377 return; | 382 return; |
| 378 | 383 |
| 379 var newName = $('create-profile-name').value; | 384 var newName = $('create-profile-name').value; |
| 380 var i; | 385 var i; |
| 381 for (i = 0; i < supervisedUsers.length; ++i) { | 386 for (i = 0; i < supervisedUsers.length; ++i) { |
| 382 if (supervisedUsers[i].name != newName) | 387 if (supervisedUsers[i].name != newName) |
| 383 continue; | 388 continue; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 399 } | 404 } |
| 400 | 405 |
| 401 var errorHtml = allOnCurrentDevice ? | 406 var errorHtml = allOnCurrentDevice ? |
| 402 loadTimeData.getStringF( | 407 loadTimeData.getStringF( |
| 403 'managedProfilesExistingLocalSupervisedUser') : | 408 'managedProfilesExistingLocalSupervisedUser') : |
| 404 loadTimeData.getStringF( | 409 loadTimeData.getStringF( |
| 405 'manageProfilesExistingSupervisedUser', | 410 'manageProfilesExistingSupervisedUser', |
| 406 HTMLEscape(elide(newName, /* maxLength */ 50))); | 411 HTMLEscape(elide(newName, /* maxLength */ 50))); |
| 407 this.showErrorBubble_(errorHtml, 'create', true); | 412 this.showErrorBubble_(errorHtml, 'create', true); |
| 408 | 413 |
| 409 $('supervised-user-import-existing').onclick = | 414 if ($('supervised-user-import-existing')) { |
| 410 this.getImportHandler_(supervisedUsers[i], nameIsUnique); | 415 $('supervised-user-import-existing').onclick = |
| 416 this.getImportHandler_(supervisedUsers[i], nameIsUnique); | |
| 417 } | |
| 411 $('create-profile-ok').disabled = true; | 418 $('create-profile-ok').disabled = true; |
| 412 return; | 419 return; |
| 413 } | 420 } |
| 414 }, | 421 }, |
| 415 | 422 |
| 416 /** | 423 /** |
| 417 * Called in case the request for the list of supervised users fails because | 424 * Called in case the request for the list of supervised users fails because |
| 418 * of a signin error. | 425 * of a signin error. |
| 419 * @private | 426 * @private |
| 420 */ | 427 */ |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 871 'updateSignedInStatus', | 878 'updateSignedInStatus', |
| 872 'updateSupervisedUsersAllowed', | 879 'updateSupervisedUsersAllowed', |
| 873 ]); | 880 ]); |
| 874 | 881 |
| 875 // Export | 882 // Export |
| 876 return { | 883 return { |
| 877 ManageProfileOverlay: ManageProfileOverlay, | 884 ManageProfileOverlay: ManageProfileOverlay, |
| 878 CreateProfileOverlay: CreateProfileOverlay, | 885 CreateProfileOverlay: CreateProfileOverlay, |
| 879 }; | 886 }; |
| 880 }); | 887 }); |
| OLD | NEW |