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 8d7bd0f6b9e1551e75943dceae5748d22fd3ce60..98c78b3c71b99daeb09780e9359a3dd3d1f9cd63 100644 |
--- a/chrome/browser/resources/options/autofill_options.js |
+++ b/chrome/browser/resources/options/autofill_options.js |
@@ -2,6 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+/** |
+ * @typedef {{ |
+ * creditCardNumber: string, |
+ * expirationMonth: string, |
+ * expirationYear: string, |
+ * guid: string, |
+ * nameOnCard: string |
+ * }} |
+ * @see chrome/browser/ui/webui/options/autofill_options_handler.cc |
+ */ |
+var CreditCardData; |
+ |
cr.define('options', function() { |
var Page = cr.ui.pageManager.Page; |
var PageManager = cr.ui.pageManager.PageManager; |
@@ -13,6 +25,7 @@ cr.define('options', function() { |
/** |
* Encapsulated handling of Autofill options page. |
* @constructor |
+ * @extends {cr.ui.pageManager.Page} |
*/ |
function AutofillOptions() { |
Page.call(this, 'autofill', |
@@ -79,8 +92,10 @@ cr.define('options', function() { |
* @private |
*/ |
createAddressList_: function() { |
- this.addressList_ = $('address-list'); |
- options.autofillOptions.AutofillAddressList.decorate(this.addressList_); |
+ var addressList = $('address-list'); |
+ options.autofillOptions.AutofillAddressList.decorate(addressList); |
+ this.addressList_ = assertInstanceof(addressList, |
+ options.DeletableItemList); |
this.addressList_.autoExpands = true; |
}, |
@@ -89,9 +104,10 @@ cr.define('options', function() { |
* @private |
*/ |
createCreditCardList_: function() { |
- this.creditCardList_ = $('creditcard-list'); |
- options.autofillOptions.AutofillCreditCardList.decorate( |
- this.creditCardList_); |
+ var creditCardList = $('creditcard-list'); |
+ options.autofillOptions.AutofillCreditCardList.decorate(creditCardList); |
+ this.creditCardList_ = assertInstanceof(creditCardList, |
+ options.DeletableItemList); |
this.creditCardList_.autoExpands = true; |
}, |
@@ -122,7 +138,7 @@ cr.define('options', function() { |
/** |
* Updates the data model for the address list with the values from |
* |entries|. |
- * @param {Array} entries The list of addresses. |
+ * @param {!Array} entries The list of addresses. |
*/ |
setAddressList_: function(entries) { |
this.addressList_.dataModel = new ArrayDataModel(entries); |
@@ -131,7 +147,7 @@ cr.define('options', function() { |
/** |
* Updates the data model for the credit card list with the values from |
* |entries|. |
- * @param {Array} entries The list of credit cards. |
+ * @param {!Array} entries The list of credit cards. |
*/ |
setCreditCardList_: function(entries) { |
this.creditCardList_.dataModel = new ArrayDataModel(entries); |
@@ -185,6 +201,7 @@ cr.define('options', function() { |
* Shows the 'Edit credit card' overlay, using the data in |credit_card| to |
* fill the input fields. |creditCard| is a list with one item, an |
* associative array that contains the credit card data. |
+ * @param {CreditCardData} creditCard |
* @private |
*/ |
showEditCreditCardOverlay_: function(creditCard) { |
@@ -219,6 +236,9 @@ cr.define('options', function() { |
AutofillOptions.getInstance().showEditAddressOverlay_(address); |
}; |
+ /** |
+ * @param {CreditCardData} creditCard |
+ */ |
AutofillOptions.editCreditCard = function(creditCard) { |
AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard); |
}; |