| 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 /** | 5 /** |
| 6 * @typedef {{ | 6 * @typedef {{ |
| 7 * creditCardNumber: string, | 7 * creditCardNumber: string, |
| 8 * expirationMonth: string, | 8 * expirationMonth: string, |
| 9 * expirationYear: string, | 9 * expirationYear: string, |
| 10 * guid: string, | 10 * guid: string, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 $('autofill-options-confirm').onclick = function(event) { | 69 $('autofill-options-confirm').onclick = function(event) { |
| 70 PageManager.closeOverlay(); | 70 PageManager.closeOverlay(); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 $('autofill-help').onclick = function(event) { | 73 $('autofill-help').onclick = function(event) { |
| 74 chrome.send('coreOptionsUserMetricsAction', | 74 chrome.send('coreOptionsUserMetricsAction', |
| 75 ['Options_AutofillShowAbout']); | 75 ['Options_AutofillShowAbout']); |
| 76 return true; // Always follow the href | 76 return true; // Always follow the href |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 this.walletIntegrationAvailableStateChanged_( | |
| 80 loadTimeData.getBoolean('autofillWalletIntegrationAvailable')); | |
| 81 | |
| 82 // TODO(jhawkins): What happens when Autofill is disabled whilst on the | 79 // TODO(jhawkins): What happens when Autofill is disabled whilst on the |
| 83 // Autofill options page? | 80 // Autofill options page? |
| 84 }, | 81 }, |
| 85 | 82 |
| 86 /** | 83 /** |
| 87 * Creates, decorates and initializes the address list. | 84 * Creates, decorates and initializes the address list. |
| 88 * @private | 85 * @private |
| 89 */ | 86 */ |
| 90 createAddressList_: function() { | 87 createAddressList_: function() { |
| 91 var addressList = $('address-list'); | 88 var addressList = $('address-list'); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 * associative array that contains the credit card data. | 177 * associative array that contains the credit card data. |
| 181 * @param {CreditCardData} creditCard | 178 * @param {CreditCardData} creditCard |
| 182 * @private | 179 * @private |
| 183 */ | 180 */ |
| 184 showEditCreditCardOverlay_: function(creditCard) { | 181 showEditCreditCardOverlay_: function(creditCard) { |
| 185 var title = loadTimeData.getString('editCreditCardTitle'); | 182 var title = loadTimeData.getString('editCreditCardTitle'); |
| 186 AutofillEditCreditCardOverlay.setTitle(title); | 183 AutofillEditCreditCardOverlay.setTitle(title); |
| 187 AutofillEditCreditCardOverlay.loadCreditCard(creditCard); | 184 AutofillEditCreditCardOverlay.loadCreditCard(creditCard); |
| 188 PageManager.showPageByName('autofillEditCreditCard'); | 185 PageManager.showPageByName('autofillEditCreditCard'); |
| 189 }, | 186 }, |
| 190 | |
| 191 /** | |
| 192 * Toggles the visibility of the Wallet integration checkbox. | |
| 193 * @param {boolean} available Whether the user has the option of using | |
| 194 * Wallet data. | |
| 195 * @private | |
| 196 */ | |
| 197 walletIntegrationAvailableStateChanged_: function(available) { | |
| 198 $('autofill-wallet-setting-area').hidden = !available; | |
| 199 }, | |
| 200 }; | 187 }; |
| 201 | 188 |
| 202 AutofillOptions.setAddressList = function(entries) { | 189 AutofillOptions.setAddressList = function(entries) { |
| 203 AutofillOptions.getInstance().setAddressList_(entries); | 190 AutofillOptions.getInstance().setAddressList_(entries); |
| 204 }; | 191 }; |
| 205 | 192 |
| 206 AutofillOptions.setCreditCardList = function(entries) { | 193 AutofillOptions.setCreditCardList = function(entries) { |
| 207 AutofillOptions.getInstance().setCreditCardList_(entries); | 194 AutofillOptions.getInstance().setCreditCardList_(entries); |
| 208 }; | 195 }; |
| 209 | 196 |
| 210 AutofillOptions.removeData = function(guid, metricsAction) { | 197 AutofillOptions.removeData = function(guid, metricsAction) { |
| 211 AutofillOptions.getInstance().removeData_(guid, metricsAction); | 198 AutofillOptions.getInstance().removeData_(guid, metricsAction); |
| 212 }; | 199 }; |
| 213 | 200 |
| 214 AutofillOptions.editAddress = function(address) { | 201 AutofillOptions.editAddress = function(address) { |
| 215 AutofillOptions.getInstance().showEditAddressOverlay_(address); | 202 AutofillOptions.getInstance().showEditAddressOverlay_(address); |
| 216 }; | 203 }; |
| 217 | 204 |
| 218 AutofillOptions.walletIntegrationAvailableStateChanged = function(available) { | |
| 219 AutofillOptions.getInstance(). | |
| 220 walletIntegrationAvailableStateChanged_(available); | |
| 221 }; | |
| 222 | |
| 223 /** | 205 /** |
| 224 * @param {CreditCardData} creditCard | 206 * @param {CreditCardData} creditCard |
| 225 */ | 207 */ |
| 226 AutofillOptions.editCreditCard = function(creditCard) { | 208 AutofillOptions.editCreditCard = function(creditCard) { |
| 227 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard); | 209 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard); |
| 228 }; | 210 }; |
| 229 | 211 |
| 230 // Export | 212 // Export |
| 231 return { | 213 return { |
| 232 AutofillOptions: AutofillOptions | 214 AutofillOptions: AutofillOptions |
| 233 }; | 215 }; |
| 234 | 216 |
| 235 }); | 217 }); |
| 236 | 218 |
| OLD | NEW |