| 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 /** @const */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 7 | 8 |
| 8 /** | 9 /** |
| 9 * AutofillEditCreditCardOverlay class | 10 * AutofillEditCreditCardOverlay class |
| 10 * Encapsulated handling of the 'Add Page' overlay page. | 11 * Encapsulated handling of the 'Add Page' overlay page. |
| 11 * @class | 12 * @class |
| 12 */ | 13 */ |
| 13 function AutofillEditCreditCardOverlay() { | 14 function AutofillEditCreditCardOverlay() { |
| 14 OptionsPage.call(this, 'autofillEditCreditCard', | 15 Page.call(this, 'autofillEditCreditCard', |
| 15 loadTimeData.getString('autofillEditCreditCardTitle'), | 16 loadTimeData.getString('autofillEditCreditCardTitle'), |
| 16 'autofill-edit-credit-card-overlay'); | 17 'autofill-edit-credit-card-overlay'); |
| 17 } | 18 } |
| 18 | 19 |
| 19 cr.addSingletonGetter(AutofillEditCreditCardOverlay); | 20 cr.addSingletonGetter(AutofillEditCreditCardOverlay); |
| 20 | 21 |
| 21 AutofillEditCreditCardOverlay.prototype = { | 22 AutofillEditCreditCardOverlay.prototype = { |
| 22 __proto__: OptionsPage.prototype, | 23 __proto__: Page.prototype, |
| 23 | 24 |
| 24 /** @override */ | 25 /** @override */ |
| 25 initializePage: function() { | 26 initializePage: function() { |
| 26 OptionsPage.prototype.initializePage.call(this); | 27 Page.prototype.initializePage.call(this); |
| 27 | 28 |
| 28 var self = this; | 29 var self = this; |
| 29 $('autofill-edit-credit-card-cancel-button').onclick = function(event) { | 30 $('autofill-edit-credit-card-cancel-button').onclick = function(event) { |
| 30 self.dismissOverlay_(); | 31 self.dismissOverlay_(); |
| 31 }; | 32 }; |
| 32 $('autofill-edit-credit-card-apply-button').onclick = function(event) { | 33 $('autofill-edit-credit-card-apply-button').onclick = function(event) { |
| 33 self.saveCreditCard_(); | 34 self.saveCreditCard_(); |
| 34 self.dismissOverlay_(); | 35 self.dismissOverlay_(); |
| 35 }; | 36 }; |
| 36 | 37 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 this.dismissOverlay_(); | 51 this.dismissOverlay_(); |
| 51 }, | 52 }, |
| 52 | 53 |
| 53 /** | 54 /** |
| 54 * Clears any uncommitted input, and dismisses the overlay. | 55 * Clears any uncommitted input, and dismisses the overlay. |
| 55 * @private | 56 * @private |
| 56 */ | 57 */ |
| 57 dismissOverlay_: function() { | 58 dismissOverlay_: function() { |
| 58 this.clearInputFields_(); | 59 this.clearInputFields_(); |
| 59 this.guid_ = ''; | 60 this.guid_ = ''; |
| 60 OptionsPage.closeOverlay(); | 61 PageManager.closeOverlay(); |
| 61 }, | 62 }, |
| 62 | 63 |
| 63 /** | 64 /** |
| 64 * Aggregates the values in the input fields into an array and sends the | 65 * Aggregates the values in the input fields into an array and sends the |
| 65 * array to the Autofill handler. | 66 * array to the Autofill handler. |
| 66 * @private | 67 * @private |
| 67 */ | 68 */ |
| 68 saveCreditCard_: function() { | 69 saveCreditCard_: function() { |
| 69 var creditCard = new Array(5); | 70 var creditCard = new Array(5); |
| 70 creditCard[0] = this.guid_; | 71 creditCard[0] = this.guid_; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 196 |
| 196 AutofillEditCreditCardOverlay.setTitle = function(title) { | 197 AutofillEditCreditCardOverlay.setTitle = function(title) { |
| 197 $('autofill-credit-card-title').textContent = title; | 198 $('autofill-credit-card-title').textContent = title; |
| 198 }; | 199 }; |
| 199 | 200 |
| 200 // Export | 201 // Export |
| 201 return { | 202 return { |
| 202 AutofillEditCreditCardOverlay: AutofillEditCreditCardOverlay | 203 AutofillEditCreditCardOverlay: AutofillEditCreditCardOverlay |
| 203 }; | 204 }; |
| 204 }); | 205 }); |
| OLD | NEW |