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

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

Issue 557633002: Add public API generation with cr.makePublic() and handle it in compiler pass (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@H_options_errors_3
Patch Set: remove fake declarations Created 6 years, 3 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
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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 return (function() { 359 return (function() {
360 if (supervisedUser.needAvatar || !nameIsUnique) { 360 if (supervisedUser.needAvatar || !nameIsUnique) {
361 PageManager.showPageByName('supervisedUserImport'); 361 PageManager.showPageByName('supervisedUserImport');
362 } else { 362 } else {
363 this.hideErrorBubble_('create'); 363 this.hideErrorBubble_('create');
364 CreateProfileOverlay.updateCreateInProgress(true); 364 CreateProfileOverlay.updateCreateInProgress(true);
365 chrome.send('createProfile', 365 chrome.send('createProfile',
366 [supervisedUser.name, supervisedUser.iconURL, false, true, 366 [supervisedUser.name, supervisedUser.iconURL, false, true,
367 supervisedUser.id]); 367 supervisedUser.id]);
368 } 368 }
369 }).bind(this); 369 }).bind(this);
Dan Beam 2014/09/12 23:43:54 nit: no () around function() {}
Vitaly Pavlenko 2014/09/13 01:22:39 Done.
370 }, 370 },
371 371
372 /** 372 /**
373 * Callback which receives the list of existing supervised users. Checks if 373 * Callback which receives the list of existing supervised users. Checks if
374 * the currently entered name is the name of an already existing supervised 374 * the currently entered name is the name of an already existing supervised
375 * user. If yes, the user is prompted to import the existing supervised 375 * user. If yes, the user is prompted to import the existing supervised
376 * user, and the create button is disabled. 376 * user, and the create button is disabled.
377 * If the received list is empty, hides the "import" link. 377 * If the received list is empty, hides the "import" link.
378 * @param {Array.<Object>} supervisedUsers The list of existing supervised 378 * @param {Array.<Object>} supervisedUsers The list of existing supervised
379 * users. 379 * users.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 /** 590 /**
591 * Display the "Create Profile" dialog. 591 * Display the "Create Profile" dialog.
592 * @private 592 * @private
593 */ 593 */
594 showCreateDialog_: function() { 594 showCreateDialog_: function() {
595 PageManager.showPageByName('createProfile'); 595 PageManager.showPageByName('createProfile');
596 }, 596 },
597 }; 597 };
598 598
599 // Forward public APIs to private implementations. 599 // Forward public APIs to private implementations.
600 [ 600 cr.makePublic(ManageProfileOverlay, [
601 'receiveDefaultProfileIconsAndNames', 601 'receiveDefaultProfileIconsAndNames',
602 'receiveNewProfileDefaults', 602 'receiveNewProfileDefaults',
603 'receiveExistingProfileNames', 603 'receiveExistingProfileNames',
604 'receiveHasProfileShortcuts', 604 'receiveHasProfileShortcuts',
605 'setProfileInfo', 605 'setProfileInfo',
606 'setProfileName', 606 'setProfileName',
607 'showManageDialog', 607 'showManageDialog',
608 'showDeleteDialog', 608 'showDeleteDialog',
609 'showDisconnectManagedProfileDialog', 609 'showDisconnectManagedProfileDialog',
610 'showCreateDialog', 610 'showCreateDialog',
611 ].forEach(function(name) { 611 ]);
612 ManageProfileOverlay[name] = function() {
613 var instance = ManageProfileOverlay.getInstance();
614 return instance[name + '_'].apply(instance, arguments);
615 };
616 });
617 612
618 function CreateProfileOverlay() { 613 function CreateProfileOverlay() {
619 Page.call(this, 'createProfile', 614 Page.call(this, 'createProfile',
620 loadTimeData.getString('createProfileTabTitle'), 615 loadTimeData.getString('createProfileTabTitle'),
621 'manage-profile-overlay'); 616 'manage-profile-overlay');
622 }; 617 };
623 618
624 cr.addSingletonGetter(CreateProfileOverlay); 619 cr.addSingletonGetter(CreateProfileOverlay);
625 620
626 CreateProfileOverlay.prototype = { 621 CreateProfileOverlay.prototype = {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 * @private 841 * @private
847 */ 842 */
848 updateCreateSupervisedUserCheckbox_: function() { 843 updateCreateSupervisedUserCheckbox_: function() {
849 $('create-profile-supervised').disabled = 844 $('create-profile-supervised').disabled =
850 !this.supervisedUsersAllowed_ || this.createInProgress_ || 845 !this.supervisedUsersAllowed_ || this.createInProgress_ ||
851 this.signedInEmail_ == '' || this.hasError_; 846 this.signedInEmail_ == '' || this.hasError_;
852 }, 847 },
853 }; 848 };
854 849
855 // Forward public APIs to private implementations. 850 // Forward public APIs to private implementations.
856 [ 851 cr.makePublic(CreateProfileOverlay, [
857 'cancelCreateProfile', 852 'cancelCreateProfile',
858 'onError', 853 'onError',
859 'onSuccess', 854 'onSuccess',
860 'onWarning', 855 'onWarning',
861 'updateCreateInProgress', 856 'updateCreateInProgress',
862 'updateSignedInStatus', 857 'updateSignedInStatus',
863 'updateSupervisedUsersAllowed', 858 'updateSupervisedUsersAllowed',
864 ].forEach(function(name) { 859 ]);
865 CreateProfileOverlay[name] = function() {
866 var instance = CreateProfileOverlay.getInstance();
867 return instance[name + '_'].apply(instance, arguments);
868 };
869 });
870 860
871 // Export 861 // Export
872 return { 862 return {
873 ManageProfileOverlay: ManageProfileOverlay, 863 ManageProfileOverlay: ManageProfileOverlay,
874 CreateProfileOverlay: CreateProfileOverlay, 864 CreateProfileOverlay: CreateProfileOverlay,
875 }; 865 };
876 }); 866 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698