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

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

Issue 3174028: DOMUI: Implement the base HTML for the 'Edit credit card' AutoFill overlay. (Closed)
Patch Set: Forgotten files. 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
Index: chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
diff --git a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
new file mode 100644
index 0000000000000000000000000000000000000000..d66f8c212f689b56cdb115b2f771a05243abc4c6
--- /dev/null
+++ b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
@@ -0,0 +1,104 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('options', function() {
+ const OptionsPage = options.OptionsPage;
+
+ /**
+ * AutoFillEditCreditCardOverlay class
+ * Encapsulated handling of the 'Add Page' overlay page.
+ * @class
+ */
+ function AutoFillEditCreditCardOverlay() {
+ OptionsPage.call(this, 'autoFillEditCreditCardOverlay',
+ templateData.autoFillEditCreditCardTitle,
+ 'autoFillEditCreditCardOverlay');
+ }
+
+ cr.addSingletonGetter(AutoFillEditCreditCardOverlay);
+
+ AutoFillEditCreditCardOverlay.prototype = {
+ __proto__: OptionsPage.prototype,
+
+ /**
+ * Initializes the page.
+ */
+ initializePage: function() {
+ OptionsPage.prototype.initializePage.call(this);
+
+ var self = this;
+ $('autoFillEditCreditCardCancelButton').onclick = function(event) {
+ self.dismissOverlay_();
+ }
+
+ self.setDefaultSelectOptions_();
+ },
+
+ /**
+ * Clears any uncommited input, and dismisses the overlay.
+ * @private
+ */
+ dismissOverlay_: function() {
+ $('fullName').value = '';
+ $('companyName').value = '';
+ $('addrLine1').value = '';
+ $('addrLine2').value = '';
+ $('city').value = '';
+ $('state').value = '';
+ $('zipCode').value = '';
+ $('phone').value = '';
+ $('fax').value = '';
+ $('email').value = '';
+ OptionsPage.clearOverlays();
+ },
+
+ /**
+ * Sets the default values of the options in the 'Billing address' and
+ * 'Expiration date' select controls.
+ * @private
+ */
+ setDefaultSelectOptions_: function() {
+ // Set the 'Billing address' default option.
+ var existingAddress = document.createElement('option');
+ existingAddress.text = localStrings.getString('chooseExistingAddress');
+ existingAddress.value = 'existingAddress';
+
+ var billingAddress = $('billingAddress');
+ billingAddress.add(existingAddress, null);
+
+ // Set the 'Expiration month' default options.
+ var expirationMonth = $('expirationMonth');
+ for (var i = 1; i <= 12; ++i) {
+ var text;
+ if (i < 10)
+ text = '0' + i;
+ else
+ text = i;
+
+ var option = document.createElement('option');
+ option.text = text;
+ option.value = text;
+ expirationMonth.add(option, null);
+ }
+
+ // Set the 'Expiration year' default options.
+ var expirationYear = $('expirationYear');
+ var date = new Date();
+ var year = date.getFullYear();
+ for (var i = 0; i < 10; ++i) {
+ var text = parseInt(year) + i;
+ var option = document.createElement('option');
+ option.text = text;
+ option.value = text;
+ expirationYear.add(option, null);
+ }
+ }
+ };
+
+ // Export
+ return {
+ AutoFillEditCreditCardOverlay: AutoFillEditCreditCardOverlay
+ };
+
+});

Powered by Google App Engine
This is Rietveld 408576698