| 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
| 10 // AutofillOptions class: | 10 // AutofillOptions class: |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Encapsulated handling of Autofill options page. | 13 * Encapsulated handling of Autofill options page. |
| 14 * @constructor | 14 * @constructor |
| 15 */ | 15 */ |
| 16 function AutofillOptions() { | 16 function AutofillOptions() { |
| 17 OptionsPage.call(this, | 17 OptionsPage.call(this, |
| 18 'autofill', | 18 'autofill', |
| 19 templateData.autofillOptionsPageTabTitle, | 19 loadTimeData.getString('autofillOptionsPageTabTitle'), |
| 20 'autofill-options'); | 20 'autofill-options'); |
| 21 } | 21 } |
| 22 | 22 |
| 23 cr.addSingletonGetter(AutofillOptions); | 23 cr.addSingletonGetter(AutofillOptions); |
| 24 | 24 |
| 25 AutofillOptions.prototype = { | 25 AutofillOptions.prototype = { |
| 26 __proto__: OptionsPage.prototype, | 26 __proto__: OptionsPage.prototype, |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * The address list. | 29 * The address list. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 this.creditCardList_.autoExpands = true; | 81 this.creditCardList_.autoExpands = true; |
| 82 }, | 82 }, |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Shows the 'Add address' overlay, specifically by loading the | 85 * Shows the 'Add address' overlay, specifically by loading the |
| 86 * 'Edit address' overlay, emptying the input fields and modifying the | 86 * 'Edit address' overlay, emptying the input fields and modifying the |
| 87 * overlay title. | 87 * overlay title. |
| 88 * @private | 88 * @private |
| 89 */ | 89 */ |
| 90 showAddAddressOverlay_: function() { | 90 showAddAddressOverlay_: function() { |
| 91 var title = localStrings.getString('addAddressTitle'); | 91 var title = loadTimeData.getString('addAddressTitle'); |
| 92 AutofillEditAddressOverlay.setTitle(title); | 92 AutofillEditAddressOverlay.setTitle(title); |
| 93 AutofillEditAddressOverlay.clearInputFields(); | 93 AutofillEditAddressOverlay.clearInputFields(); |
| 94 OptionsPage.navigateToPage('autofillEditAddress'); | 94 OptionsPage.navigateToPage('autofillEditAddress'); |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Shows the 'Add credit card' overlay, specifically by loading the | 98 * Shows the 'Add credit card' overlay, specifically by loading the |
| 99 * 'Edit credit card' overlay, emptying the input fields and modifying the | 99 * 'Edit credit card' overlay, emptying the input fields and modifying the |
| 100 * overlay title. | 100 * overlay title. |
| 101 * @private | 101 * @private |
| 102 */ | 102 */ |
| 103 showAddCreditCardOverlay_: function() { | 103 showAddCreditCardOverlay_: function() { |
| 104 var title = localStrings.getString('addCreditCardTitle'); | 104 var title = loadTimeData.getString('addCreditCardTitle'); |
| 105 AutofillEditCreditCardOverlay.setTitle(title); | 105 AutofillEditCreditCardOverlay.setTitle(title); |
| 106 AutofillEditCreditCardOverlay.clearInputFields(); | 106 AutofillEditCreditCardOverlay.clearInputFields(); |
| 107 OptionsPage.navigateToPage('autofillEditCreditCard'); | 107 OptionsPage.navigateToPage('autofillEditCreditCard'); |
| 108 }, | 108 }, |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Updates the data model for the address list with the values from | 111 * Updates the data model for the address list with the values from |
| 112 * |entries|. | 112 * |entries|. |
| 113 * @param {Array} entries The list of addresses. | 113 * @param {Array} entries The list of addresses. |
| 114 */ | 114 */ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 chrome.send('loadCreditCardEditor', [guid]); | 165 chrome.send('loadCreditCardEditor', [guid]); |
| 166 }, | 166 }, |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * Shows the 'Edit address' overlay, using the data in |address| to fill the | 169 * Shows the 'Edit address' overlay, using the data in |address| to fill the |
| 170 * input fields. |address| is a list with one item, an associative array | 170 * input fields. |address| is a list with one item, an associative array |
| 171 * that contains the address data. | 171 * that contains the address data. |
| 172 * @private | 172 * @private |
| 173 */ | 173 */ |
| 174 showEditAddressOverlay_: function(address) { | 174 showEditAddressOverlay_: function(address) { |
| 175 var title = localStrings.getString('editAddressTitle'); | 175 var title = loadTimeData.getString('editAddressTitle'); |
| 176 AutofillEditAddressOverlay.setTitle(title); | 176 AutofillEditAddressOverlay.setTitle(title); |
| 177 AutofillEditAddressOverlay.loadAddress(address); | 177 AutofillEditAddressOverlay.loadAddress(address); |
| 178 OptionsPage.navigateToPage('autofillEditAddress'); | 178 OptionsPage.navigateToPage('autofillEditAddress'); |
| 179 }, | 179 }, |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * Shows the 'Edit credit card' overlay, using the data in |credit_card| to | 182 * Shows the 'Edit credit card' overlay, using the data in |credit_card| to |
| 183 * fill the input fields. |address| is a list with one item, an associative | 183 * fill the input fields. |address| is a list with one item, an associative |
| 184 * array that contains the credit card data. | 184 * array that contains the credit card data. |
| 185 * @private | 185 * @private |
| 186 */ | 186 */ |
| 187 showEditCreditCardOverlay_: function(creditCard) { | 187 showEditCreditCardOverlay_: function(creditCard) { |
| 188 var title = localStrings.getString('editCreditCardTitle'); | 188 var title = loadTimeData.getString('editCreditCardTitle'); |
| 189 AutofillEditCreditCardOverlay.setTitle(title); | 189 AutofillEditCreditCardOverlay.setTitle(title); |
| 190 AutofillEditCreditCardOverlay.loadCreditCard(creditCard); | 190 AutofillEditCreditCardOverlay.loadCreditCard(creditCard); |
| 191 OptionsPage.navigateToPage('autofillEditCreditCard'); | 191 OptionsPage.navigateToPage('autofillEditCreditCard'); |
| 192 }, | 192 }, |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 AutofillOptions.setAddressList = function(entries) { | 195 AutofillOptions.setAddressList = function(entries) { |
| 196 AutofillOptions.getInstance().setAddressList_(entries); | 196 AutofillOptions.getInstance().setAddressList_(entries); |
| 197 }; | 197 }; |
| 198 | 198 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 224 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard); | 224 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard); |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 // Export | 227 // Export |
| 228 return { | 228 return { |
| 229 AutofillOptions: AutofillOptions | 229 AutofillOptions: AutofillOptions |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 }); | 232 }); |
| 233 | 233 |
| OLD | NEW |