| 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 /** |
| 11 * ManageProfileOverlay class | 11 * ManageProfileOverlay class |
| 12 * Encapsulated handling of the 'Manage profile...' overlay page. | 12 * Encapsulated handling of the 'Manage profile...' overlay page. |
| 13 * @constructor | 13 * @constructor |
| 14 * @extends {cr.ui.pageManager.Page} | 14 * @extends {cr.ui.pageManager.Page} |
| 15 */ | 15 */ |
| 16 function ManageProfileOverlay() { | 16 function ManageProfileOverlay() { |
| 17 Page.call(this, 'manageProfile', | 17 Page.call(this, 'manageProfile', |
| 18 loadTimeData.getString('manageProfileTabTitle'), | 18 loadTimeData.getString('manageProfileTabTitle'), |
| 19 'manage-profile-overlay'); | 19 'manage-profile-overlay'); |
| 20 }; | 20 } |
| 21 | 21 |
| 22 cr.addSingletonGetter(ManageProfileOverlay); | 22 cr.addSingletonGetter(ManageProfileOverlay); |
| 23 | 23 |
| 24 ManageProfileOverlay.prototype = { | 24 ManageProfileOverlay.prototype = { |
| 25 // Inherit from Page. | 25 // Inherit from Page. |
| 26 __proto__: Page.prototype, | 26 __proto__: Page.prototype, |
| 27 | 27 |
| 28 // Info about the currently managed/deleted profile. | 28 // Info about the currently managed/deleted profile. |
| 29 profileInfo_: null, | 29 profileInfo_: null, |
| 30 | 30 |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 loadTimeData.overrideValues(replacements); | 588 loadTimeData.overrideValues(replacements); |
| 589 $('manage-profile-overlay-create').hidden = true; | 589 $('manage-profile-overlay-create').hidden = true; |
| 590 $('manage-profile-overlay-manage').hidden = true; | 590 $('manage-profile-overlay-manage').hidden = true; |
| 591 $('manage-profile-overlay-delete').hidden = true; | 591 $('manage-profile-overlay-delete').hidden = true; |
| 592 $('disconnect-managed-profile-domain-information').innerHTML = | 592 $('disconnect-managed-profile-domain-information').innerHTML = |
| 593 loadTimeData.getString('disconnectManagedProfileDomainInformation'); | 593 loadTimeData.getString('disconnectManagedProfileDomainInformation'); |
| 594 $('disconnect-managed-profile-text').innerHTML = | 594 $('disconnect-managed-profile-text').innerHTML = |
| 595 loadTimeData.getString('disconnectManagedProfileText'); | 595 loadTimeData.getString('disconnectManagedProfileText'); |
| 596 $('manage-profile-overlay-disconnect-managed').hidden = false; | 596 $('manage-profile-overlay-disconnect-managed').hidden = false; |
| 597 | 597 |
| 598 // Because this dialog isn't useful when refreshing or as part of the | 598 PageManager.showPageByName('signOut'); |
| 599 // history, don't create a history entry for it when showing. | |
| 600 PageManager.showPageByName('manageProfile', false); | |
| 601 }, | 599 }, |
| 602 | 600 |
| 603 /** | 601 /** |
| 604 * Display the "Create Profile" dialog. | 602 * Display the "Create Profile" dialog. |
| 605 * @private | 603 * @private |
| 606 */ | 604 */ |
| 607 showCreateDialog_: function() { | 605 showCreateDialog_: function() { |
| 608 PageManager.showPageByName('createProfile'); | 606 PageManager.showPageByName('createProfile'); |
| 609 }, | 607 }, |
| 610 }; | 608 }; |
| 611 | 609 |
| 612 // Forward public APIs to private implementations. | 610 // Forward public APIs to private implementations. |
| 613 cr.makePublic(ManageProfileOverlay, [ | 611 cr.makePublic(ManageProfileOverlay, [ |
| 614 'receiveDefaultProfileIconsAndNames', | 612 'receiveDefaultProfileIconsAndNames', |
| 615 'receiveNewProfileDefaults', | 613 'receiveNewProfileDefaults', |
| 616 'receiveExistingProfileNames', | 614 'receiveExistingProfileNames', |
| 617 'receiveHasProfileShortcuts', | 615 'receiveHasProfileShortcuts', |
| 618 'setProfileInfo', | 616 'setProfileInfo', |
| 619 'setProfileName', | 617 'setProfileName', |
| 620 'showManageDialog', | 618 'showManageDialog', |
| 621 'showDeleteDialog', | 619 'showDeleteDialog', |
| 622 'showDisconnectManagedProfileDialog', | 620 'showDisconnectManagedProfileDialog', |
| 623 'showCreateDialog', | 621 'showCreateDialog', |
| 624 ]); | 622 ]); |
| 625 | 623 |
| 624 /** |
| 625 * @constructor |
| 626 * @extends {options.ManageProfileOverlay} |
| 627 */ |
| 628 function DisconnectAccountOverlay() { |
| 629 Page.call(this, 'signOut', |
| 630 loadTimeData.getString('disconnectAccountTabTitle'), |
| 631 'manage-profile-overlay'); |
| 632 } |
| 633 |
| 634 cr.addSingletonGetter(DisconnectAccountOverlay); |
| 635 |
| 636 DisconnectAccountOverlay.prototype = { |
| 637 __proto__: ManageProfileOverlay.prototype, |
| 638 |
| 639 /** @override */ |
| 640 canShowPage: function() { |
| 641 var syncData = loadTimeData.getValue('syncData'); |
| 642 return syncData.signedIn && !syncData.signoutAllowed; |
| 643 }, |
| 644 |
| 645 /** @override */ |
| 646 didShowPage: function() { |
| 647 chrome.send('showDisconnectManagedProfileDialog'); |
| 648 } |
| 649 }; |
| 650 |
| 651 /** |
| 652 * @constructor |
| 653 * @extends {options.ManageProfileOverlay} |
| 654 */ |
| 626 function CreateProfileOverlay() { | 655 function CreateProfileOverlay() { |
| 627 Page.call(this, 'createProfile', | 656 Page.call(this, 'createProfile', |
| 628 loadTimeData.getString('createProfileTabTitle'), | 657 loadTimeData.getString('createProfileTabTitle'), |
| 629 'manage-profile-overlay'); | 658 'manage-profile-overlay'); |
| 630 }; | 659 } |
| 631 | 660 |
| 632 cr.addSingletonGetter(CreateProfileOverlay); | 661 cr.addSingletonGetter(CreateProfileOverlay); |
| 633 | 662 |
| 634 CreateProfileOverlay.prototype = { | 663 CreateProfileOverlay.prototype = { |
| 635 // Inherit from ManageProfileOverlay. | |
| 636 __proto__: ManageProfileOverlay.prototype, | 664 __proto__: ManageProfileOverlay.prototype, |
| 637 | 665 |
| 638 // The signed-in email address of the current profile, or empty if they're | 666 // The signed-in email address of the current profile, or empty if they're |
| 639 // not signed in. | 667 // not signed in. |
| 640 signedInEmail_: '', | 668 signedInEmail_: '', |
| 641 | 669 |
| 642 /** @override */ | 670 /** @override */ |
| 643 canShowPage: function() { | 671 canShowPage: function() { |
| 644 return !BrowserOptions.getCurrentProfile().isSupervised; | 672 return !BrowserOptions.getCurrentProfile().isSupervised; |
| 645 }, | 673 }, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 'onSuccess', | 904 'onSuccess', |
| 877 'onWarning', | 905 'onWarning', |
| 878 'updateCreateInProgress', | 906 'updateCreateInProgress', |
| 879 'updateSignedInStatus', | 907 'updateSignedInStatus', |
| 880 'updateSupervisedUsersAllowed', | 908 'updateSupervisedUsersAllowed', |
| 881 ]); | 909 ]); |
| 882 | 910 |
| 883 // Export | 911 // Export |
| 884 return { | 912 return { |
| 885 ManageProfileOverlay: ManageProfileOverlay, | 913 ManageProfileOverlay: ManageProfileOverlay, |
| 914 DisconnectAccountOverlay: DisconnectAccountOverlay, |
| 886 CreateProfileOverlay: CreateProfileOverlay, | 915 CreateProfileOverlay: CreateProfileOverlay, |
| 887 }; | 916 }; |
| 888 }); | 917 }); |
| OLD | NEW |