| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 /** | 327 /** |
| 328 * Called when the profile name is changed or the 'create supervised' | 328 * Called when the profile name is changed or the 'create supervised' |
| 329 * checkbox is toggled. Updates the 'ok' button and the 'import existing | 329 * checkbox is toggled. Updates the 'ok' button and the 'import existing |
| 330 * supervised user' link. | 330 * supervised user' link. |
| 331 * @param {string} mode A label that specifies the type of dialog box which | 331 * @param {string} mode A label that specifies the type of dialog box which |
| 332 * is currently being viewed (i.e. 'create' or 'manage'). | 332 * is currently being viewed (i.e. 'create' or 'manage'). |
| 333 * @private | 333 * @private |
| 334 */ | 334 */ |
| 335 updateCreateOrImport_: function(mode) { | 335 updateCreateOrImport_: function(mode) { |
| 336 this.updateOkButton_(mode); |
| 336 // In 'create' mode, check for existing supervised users with the same | 337 // In 'create' mode, check for existing supervised users with the same |
| 337 // name. | 338 // name. |
| 338 if (mode == 'create') { | 339 if (mode == 'create') |
| 339 this.requestExistingSupervisedUsers_(); | 340 this.requestExistingSupervisedUsers_(); |
| 340 } else { | |
| 341 this.updateOkButton_(mode); | |
| 342 } | |
| 343 }, | 341 }, |
| 344 | 342 |
| 345 /** | 343 /** |
| 346 * Tries to get the list of existing supervised users and updates the UI | 344 * Tries to get the list of existing supervised users and updates the UI |
| 347 * accordingly. | 345 * accordingly. |
| 348 * @private | 346 * @private |
| 349 */ | 347 */ |
| 350 requestExistingSupervisedUsers_: function() { | 348 requestExistingSupervisedUsers_: function() { |
| 351 options.SupervisedUserListData.requestExistingSupervisedUsers().then( | 349 options.SupervisedUserListData.requestExistingSupervisedUsers().then( |
| 352 this.receiveExistingSupervisedUsers_.bind(this), | 350 this.receiveExistingSupervisedUsers_.bind(this), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 supervisedUser.id]); | 398 supervisedUser.id]); |
| 401 } | 399 } |
| 402 } | 400 } |
| 403 }; | 401 }; |
| 404 $('supervised-user-import-existing').onclick = | 402 $('supervised-user-import-existing').onclick = |
| 405 getImportHandler(supervisedUsers[i], nameIsUnique); | 403 getImportHandler(supervisedUsers[i], nameIsUnique); |
| 406 $('create-profile-ok').disabled = true; | 404 $('create-profile-ok').disabled = true; |
| 407 return; | 405 return; |
| 408 } | 406 } |
| 409 } | 407 } |
| 410 this.updateOkButton_('create'); | |
| 411 }, | 408 }, |
| 412 | 409 |
| 413 /** | 410 /** |
| 414 * Called in case the request for the list of supervised users fails because | 411 * Called in case the request for the list of supervised users fails because |
| 415 * of a signin error. | 412 * of a signin error. |
| 416 * @private | 413 * @private |
| 417 */ | 414 */ |
| 418 onSigninError_: function() { | 415 onSigninError_: function() { |
| 419 this.updateSignedInStatus_(this.signedInEmail_, true); | 416 this.updateSignedInStatus_(this.signedInEmail_, true); |
| 420 }, | 417 }, |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 return instance[name + '_'].apply(instance, arguments); | 861 return instance[name + '_'].apply(instance, arguments); |
| 865 }; | 862 }; |
| 866 }); | 863 }); |
| 867 | 864 |
| 868 // Export | 865 // Export |
| 869 return { | 866 return { |
| 870 ManageProfileOverlay: ManageProfileOverlay, | 867 ManageProfileOverlay: ManageProfileOverlay, |
| 871 CreateProfileOverlay: CreateProfileOverlay, | 868 CreateProfileOverlay: CreateProfileOverlay, |
| 872 }; | 869 }; |
| 873 }); | 870 }); |
| OLD | NEW |