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 /** | 25 /** |
25 * Initializes the page. | 26 * Initializes the page. |
26 */ | 27 */ |
27 initializePage: function() { | 28 initializePage: function() { |
28 OptionsPage.prototype.initializePage.call(this); | 29 Page.prototype.initializePage.call(this); |
29 | 30 |
30 var self = this; | 31 var self = this; |
31 $('autofill-edit-credit-card-cancel-button').onclick = function(event) { | 32 $('autofill-edit-credit-card-cancel-button').onclick = function(event) { |
32 self.dismissOverlay_(); | 33 self.dismissOverlay_(); |
33 }; | 34 }; |
34 $('autofill-edit-credit-card-apply-button').onclick = function(event) { | 35 $('autofill-edit-credit-card-apply-button').onclick = function(event) { |
35 self.saveCreditCard_(); | 36 self.saveCreditCard_(); |
36 self.dismissOverlay_(); | 37 self.dismissOverlay_(); |
37 }; | 38 }; |
38 | 39 |
(...skipping 13 matching lines...) Expand all Loading... |
52 this.dismissOverlay_(); | 53 this.dismissOverlay_(); |
53 }, | 54 }, |
54 | 55 |
55 /** | 56 /** |
56 * Clears any uncommitted input, and dismisses the overlay. | 57 * Clears any uncommitted input, and dismisses the overlay. |
57 * @private | 58 * @private |
58 */ | 59 */ |
59 dismissOverlay_: function() { | 60 dismissOverlay_: function() { |
60 this.clearInputFields_(); | 61 this.clearInputFields_(); |
61 this.guid_ = ''; | 62 this.guid_ = ''; |
62 OptionsPage.closeOverlay(); | 63 PageManager.closeOverlay(); |
63 }, | 64 }, |
64 | 65 |
65 /** | 66 /** |
66 * Aggregates the values in the input fields into an array and sends the | 67 * Aggregates the values in the input fields into an array and sends the |
67 * array to the Autofill handler. | 68 * array to the Autofill handler. |
68 * @private | 69 * @private |
69 */ | 70 */ |
70 saveCreditCard_: function() { | 71 saveCreditCard_: function() { |
71 var creditCard = new Array(5); | 72 var creditCard = new Array(5); |
72 creditCard[0] = this.guid_; | 73 creditCard[0] = this.guid_; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 198 |
198 AutofillEditCreditCardOverlay.setTitle = function(title) { | 199 AutofillEditCreditCardOverlay.setTitle = function(title) { |
199 $('autofill-credit-card-title').textContent = title; | 200 $('autofill-credit-card-title').textContent = title; |
200 }; | 201 }; |
201 | 202 |
202 // Export | 203 // Export |
203 return { | 204 return { |
204 AutofillEditCreditCardOverlay: AutofillEditCreditCardOverlay | 205 AutofillEditCreditCardOverlay: AutofillEditCreditCardOverlay |
205 }; | 206 }; |
206 }); | 207 }); |
OLD | NEW |