| Index: chrome/browser/resources/options/autofill_options.js
|
| diff --git a/chrome/browser/resources/options/autofill_options.js b/chrome/browser/resources/options/autofill_options.js
|
| index 1612dc4d03f07983532ab5c39f8b12dddafaaf7b..cf8d75799f7a8ea4f69c0df27f876367b227fe09 100644
|
| --- a/chrome/browser/resources/options/autofill_options.js
|
| +++ b/chrome/browser/resources/options/autofill_options.js
|
| @@ -37,17 +37,17 @@ cr.define('options', function() {
|
|
|
| var self = this;
|
| $('profileList').onchange = function(event) {
|
| - self.updateRemoveButtonState_();
|
| + self.updateButtonState_();
|
| };
|
| $('addAddressButton').onclick = function(event) {
|
| - OptionsPage.showOverlay('autoFillEditAddressOverlay');
|
| + self.showAddAddressOverlay_();
|
| };
|
| $('addCreditCardButton').onclick = function(event) {
|
| - OptionsPage.showOverlay('autoFillEditCreditCardOverlay');
|
| + self.showAddCreditCardOverlay_();
|
| };
|
|
|
| Preferences.getInstance().addEventListener('autofill.enabled',
|
| - cr.bind(self.updateButtonState_, self));
|
| + cr.bind(self.updateEnabledState_, self));
|
| },
|
|
|
| /**
|
| @@ -55,7 +55,7 @@ cr.define('options', function() {
|
| * of the |autoFillEnabled| checkbox.
|
| * @private
|
| */
|
| - updateButtonState_: function() {
|
| + updateEnabledState_: function() {
|
| var checkbox = $('autoFillEnabled');
|
| $('addAddressButton').disabled = $('addCreditCardButton').disabled =
|
| $('editButton').disabled = $('autoFillRemoveButton').disabled =
|
| @@ -63,6 +63,32 @@ cr.define('options', function() {
|
| },
|
|
|
| /**
|
| + * Shows the 'Add address' overlay, specifically by loading the
|
| + * 'Edit address' overlay, emptying the input fields and modifying the
|
| + * overlay title.
|
| + * @private
|
| + */
|
| + showAddAddressOverlay_: function() {
|
| + var title = localStrings.getString('addAddressTitle');
|
| + AutoFillEditAddressOverlay.setTitle(title);
|
| + AutoFillEditAddressOverlay.clearInputFields();
|
| + OptionsPage.showOverlay('autoFillEditAddressOverlay');
|
| + },
|
| +
|
| + /**
|
| + * Shows the 'Add credit card' overlay, specifically by loading the
|
| + * 'Edit credit card' overlay, emptying the input fields and modifying the
|
| + * overlay title.
|
| + * @private
|
| + */
|
| + showAddCreditCardOverlay_: function() {
|
| + var title = localStrings.getString('addCreditCardTitle');
|
| + AutoFillEditCreditCardOverlay.setTitle(title);
|
| + AutoFillEditCreditCardOverlay.clearInputFields();
|
| + OptionsPage.showOverlay('autoFillEditCreditCardOverlay');
|
| + },
|
| +
|
| + /**
|
| * Resets the address list. This method leaves the header and horizontal
|
| * rule unchanged.
|
| * @private
|
| @@ -102,7 +128,7 @@ cr.define('options', function() {
|
| profileList.add(option, blankAddress);
|
| }
|
|
|
| - this.updateRemoveButtonState_();
|
| + this.updateButtonState_();
|
| },
|
|
|
| /**
|
| @@ -120,16 +146,16 @@ cr.define('options', function() {
|
| profileList.add(option, null);
|
| }
|
|
|
| - this.updateRemoveButtonState_();
|
| + this.updateButtonState_();
|
| },
|
|
|
| /**
|
| - * Sets the enabled state of the AutoFill Remove button based on the current
|
| - * selection in the profile list.
|
| + * Sets the enabled state of the AutoFill Edit and Remove buttons based on
|
| + * the current selection in the profile list.
|
| * @private
|
| */
|
| - updateRemoveButtonState_: function() {
|
| - $('autoFillRemoveButton').disabled =
|
| + updateButtonState_: function() {
|
| + $('autoFillRemoveButton').disabled = $('autoFillEditButton').disabled =
|
| ($('profileList').selectedIndex == -1);
|
| },
|
| };
|
|
|