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

Side by Side Diff: chrome/browser/resources/options/manage_profile_overlay.js

Issue 1564063002: Fixing the hiding error bubble animation bug on second opening of create user dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Because the callback is called after the supervised user is created
Marc Treib 2016/01/07 14:42:48 Hm, this kinda makes it sound like that's the only
atanasova 2016/01/07 15:03:10 Done.
375 // and before the overlay is closed, the error bubble is shown. That
376 // causes the hiding animation to be shown when you reopen the dialog.
377 if (CreateProfileOverlay.getCreateInProgress())
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
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')) {
Marc Treib 2016/01/07 14:42:48 Why is this necessary?
atanasova 2016/01/07 15:03:10 If we display the error without the import option,
Marc Treib 2016/01/07 16:11:23 Ah, so it's a pre-existing problem? Okay then, car
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 'create', 693 'create',
687 false); 694 false);
688 }, 695 },
689 696
690 /** @override */ 697 /** @override */
691 hideErrorBubble_: function() { 698 hideErrorBubble_: function() {
692 ManageProfileOverlay.getInstance().hideErrorBubble_('create'); 699 ManageProfileOverlay.getInstance().hideErrorBubble_('create');
693 }, 700 },
694 701
695 /** 702 /**
703 * Get createInProgress_. This is needed for the create user overlay.
704 * We do not want to show the errorBubble if a profile is being created.
Marc Treib 2016/01/07 14:42:48 Please describe what the method does, not what it'
atanasova 2016/01/07 15:03:10 Done.
705 * @private
706 */
707 getCreateInProgress_: function() {
708 return this.createInProgress_;
709 },
710
711 /**
696 * Updates the UI when a profile create step begins or ends. 712 * Updates the UI when a profile create step begins or ends.
697 * Note that hideErrorBubble_() also enables the "OK" button, so it 713 * Note that hideErrorBubble_() also enables the "OK" button, so it
698 * must be called before this function if both are used. 714 * must be called before this function if both are used.
699 * @param {boolean} inProgress True if the UI should be updated to show that 715 * @param {boolean} inProgress True if the UI should be updated to show that
700 * profile creation is now in progress. 716 * profile creation is now in progress.
701 * @private 717 * @private
702 */ 718 */
703 updateCreateInProgress_: function(inProgress) { 719 updateCreateInProgress_: function(inProgress) {
704 this.createInProgress_ = inProgress; 720 this.createInProgress_ = inProgress;
705 this.updateCreateSupervisedUserCheckbox_(); 721 this.updateCreateSupervisedUserCheckbox_();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 * creating a new profile; otherwise, the handler will open a new window. 768 * creating a new profile; otherwise, the handler will open a new window.
753 * @param {Object} profileInfo An object of the form: 769 * @param {Object} profileInfo An object of the form:
754 * profileInfo = { 770 * profileInfo = {
755 * name: "Profile Name", 771 * name: "Profile Name",
756 * filePath: "/path/to/profile/data/on/disk" 772 * filePath: "/path/to/profile/data/on/disk"
757 * isSupervised: (true|false), 773 * isSupervised: (true|false),
758 * }; 774 * };
759 * @private 775 * @private
760 */ 776 */
761 onSuccess_: function(profileInfo) { 777 onSuccess_: function(profileInfo) {
762 this.updateCreateInProgress_(false);
Marc Treib 2016/01/07 14:42:48 Why remove this?
atanasova 2016/01/07 15:03:10 In the description I tried to explain it, but I no
Marc Treib 2016/01/07 16:11:23 Hm. I guess the callback being called does not nec
atanasova 2016/01/07 16:22:44 It is needed in the onError method, since then we
763 PageManager.closeOverlay(); 778 PageManager.closeOverlay();
764 if (profileInfo.isSupervised) { 779 if (profileInfo.isSupervised) {
765 options.SupervisedUserListData.resetPromise(); 780 options.SupervisedUserListData.resetPromise();
766 profileInfo.custodianEmail = this.signedInEmail_; 781 profileInfo.custodianEmail = this.signedInEmail_;
767 SupervisedUserCreateConfirmOverlay.setProfileInfo(profileInfo); 782 SupervisedUserCreateConfirmOverlay.setProfileInfo(profileInfo);
768 PageManager.showPageByName('supervisedUserCreateConfirm', false); 783 PageManager.showPageByName('supervisedUserCreateConfirm', false);
769 BrowserOptions.updateManagesSupervisedUsers(true); 784 BrowserOptions.updateManagesSupervisedUsers(true);
770 } 785 }
771 }, 786 },
772 787
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 this.signedInEmail_ == '' || this.hasError_; 875 this.signedInEmail_ == '' || this.hasError_;
861 }, 876 },
862 }; 877 };
863 878
864 // Forward public APIs to private implementations. 879 // Forward public APIs to private implementations.
865 cr.makePublic(CreateProfileOverlay, [ 880 cr.makePublic(CreateProfileOverlay, [
866 'cancelCreateProfile', 881 'cancelCreateProfile',
867 'onError', 882 'onError',
868 'onSuccess', 883 'onSuccess',
869 'onWarning', 884 'onWarning',
885 'getCreateInProgress',
870 'updateCreateInProgress', 886 'updateCreateInProgress',
871 'updateSignedInStatus', 887 'updateSignedInStatus',
872 'updateSupervisedUsersAllowed', 888 'updateSupervisedUsersAllowed',
873 ]); 889 ]);
874 890
875 // Export 891 // Export
876 return { 892 return {
877 ManageProfileOverlay: ManageProfileOverlay, 893 ManageProfileOverlay: ManageProfileOverlay,
878 CreateProfileOverlay: CreateProfileOverlay, 894 CreateProfileOverlay: CreateProfileOverlay,
879 }; 895 };
880 }); 896 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698