Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: chrome/browser/resources/options/autofill_options.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 21
22 ///////////////////////////////////////////////////////////////////////////// 22 /////////////////////////////////////////////////////////////////////////////
23 // AutofillOptions class: 23 // AutofillOptions class:
24 24
25 /** 25 /**
26 * Encapsulated handling of Autofill options page. 26 * Encapsulated handling of Autofill options page.
27 * @constructor 27 * @constructor
28 * @extends {cr.ui.pageManager.Page} 28 * @extends {cr.ui.pageManager.Page}
29 */ 29 */
30 function AutofillOptions() { 30 function AutofillOptions() {
31 Page.call(this, 'autofill', 31 Page.call(
32 loadTimeData.getString('autofillOptionsPageTabTitle'), 32 this, 'autofill', loadTimeData.getString('autofillOptionsPageTabTitle'),
33 'autofill-options'); 33 'autofill-options');
34 } 34 }
35 35
36 cr.addSingletonGetter(AutofillOptions); 36 cr.addSingletonGetter(AutofillOptions);
37 37
38 AutofillOptions.prototype = { 38 AutofillOptions.prototype = {
39 __proto__: Page.prototype, 39 __proto__: Page.prototype,
40 40
41 /** 41 /**
42 * The address list. 42 * The address list.
43 * @type {options.DeletableItemList} 43 * @type {options.DeletableItemList}
(...skipping 20 matching lines...) Expand all
64 self.showAddAddressOverlay_(); 64 self.showAddAddressOverlay_();
65 }; 65 };
66 $('autofill-add-creditcard').onclick = function(event) { 66 $('autofill-add-creditcard').onclick = function(event) {
67 self.showAddCreditCardOverlay_(); 67 self.showAddCreditCardOverlay_();
68 }; 68 };
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(
75 ['Options_AutofillShowAbout']); 75 'coreOptionsUserMetricsAction', ['Options_AutofillShowAbout']);
76 return true; // Always follow the href 76 return true; // Always follow the href
77 }; 77 };
78 78
79 // TODO(jhawkins): What happens when Autofill is disabled whilst on the 79 // TODO(jhawkins): What happens when Autofill is disabled whilst on the
80 // Autofill options page? 80 // Autofill options page?
81 }, 81 },
82 82
83 /** 83 /**
84 * Creates, decorates and initializes the address list. 84 * Creates, decorates and initializes the address list.
85 * @private 85 * @private
86 */ 86 */
87 createAddressList_: function() { 87 createAddressList_: function() {
88 var addressList = $('address-list'); 88 var addressList = $('address-list');
89 options.autofillOptions.AutofillAddressList.decorate(addressList); 89 options.autofillOptions.AutofillAddressList.decorate(addressList);
90 this.addressList_ = assertInstanceof(addressList, 90 this.addressList_ =
91 options.DeletableItemList); 91 assertInstanceof(addressList, options.DeletableItemList);
92 this.addressList_.autoExpands = true; 92 this.addressList_.autoExpands = true;
93 }, 93 },
94 94
95 /** 95 /**
96 * Creates, decorates and initializes the credit card list. 96 * Creates, decorates and initializes the credit card list.
97 * @private 97 * @private
98 */ 98 */
99 createCreditCardList_: function() { 99 createCreditCardList_: function() {
100 var creditCardList = $('creditcard-list'); 100 var creditCardList = $('creditcard-list');
101 options.autofillOptions.AutofillCreditCardList.decorate(creditCardList); 101 options.autofillOptions.AutofillCreditCardList.decorate(creditCardList);
102 this.creditCardList_ = assertInstanceof(creditCardList, 102 this.creditCardList_ =
103 options.DeletableItemList); 103 assertInstanceof(creditCardList, options.DeletableItemList);
104 this.creditCardList_.autoExpands = true; 104 this.creditCardList_.autoExpands = true;
105 }, 105 },
106 106
107 /** 107 /**
108 * Shows the 'Add address' overlay, specifically by loading the 108 * Shows the 'Add address' overlay, specifically by loading the
109 * 'Edit address' overlay and modifying the overlay title. 109 * 'Edit address' overlay and modifying the overlay title.
110 * @private 110 * @private
111 */ 111 */
112 showAddAddressOverlay_: function() { 112 showAddAddressOverlay_: function() {
113 var title = loadTimeData.getString('addAddressTitle'); 113 var title = loadTimeData.getString('addAddressTitle');
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 }; 203 };
204 204
205 /** 205 /**
206 * @param {CreditCardData} creditCard 206 * @param {CreditCardData} creditCard
207 */ 207 */
208 AutofillOptions.editCreditCard = function(creditCard) { 208 AutofillOptions.editCreditCard = function(creditCard) {
209 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard); 209 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard);
210 }; 210 };
211 211
212 // Export 212 // Export
213 return { 213 return {AutofillOptions: AutofillOptions};
214 AutofillOptions: AutofillOptions
215 };
216 214
217 }); 215 });
218
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698