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

Unified Diff: chrome/browser/resources/options/autofill_options.js

Issue 3125039: DOMUI: Several fixes for AutoFill page. (Closed)
Patch Set: Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/autofill_options.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
},
};
« no previous file with comments | « chrome/browser/resources/options/autofill_options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698