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

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

Issue 1027393002: Autofill settings - Fix editing of local addresses and credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/autofill_options_list.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 * @param {string=} metricsAction The name of the action to log for metrics. 168 * @param {string=} metricsAction The name of the action to log for metrics.
169 * @private 169 * @private
170 */ 170 */
171 removeData_: function(guid, metricsAction) { 171 removeData_: function(guid, metricsAction) {
172 chrome.send('removeData', [guid]); 172 chrome.send('removeData', [guid]);
173 if (metricsAction) 173 if (metricsAction)
174 chrome.send('coreOptionsUserMetricsAction', [metricsAction]); 174 chrome.send('coreOptionsUserMetricsAction', [metricsAction]);
175 }, 175 },
176 176
177 /** 177 /**
178 * For local Autofill data, this function causes the AutofillOptionsHandler
179 * to call showEditAddressOverlay(). For Wallet data, the user is
180 * redirected to the Wallet web interface.
181 * @param {Object} entry The relevant entry in data model.
182 * @private
183 */
184 loadAddressEditor_: function(entry) {
185 if (entry.isLocal)
186 chrome.send('loadAddressEditor', [entry.guid]);
187 else
188 window.open(loadTimeData.getString('manageWalletAddressesUrl'));
189 },
190
191 /**
192 * For local Autofill data, this function causes the AutofillOptionsHandler
193 * to call showEditCreditCardOverlay(). For Wallet data, the user is
194 * redirected to the Wallet web interface.
195 * @param {Object} entry The relevant entry in data model.
196 * @private
197 */
198 loadCreditCardEditor_: function(entry) {
199 if (entry.isLocal)
200 chrome.send('loadCreditCardEditor', [entry.guid]);
201 else
202 window.open(loadTimeData.getString('manageWalletPaymentMethodsUrl'));
203 },
204
205 /**
206 * Shows the 'Edit address' overlay, using the data in |address| to fill the 178 * Shows the 'Edit address' overlay, using the data in |address| to fill the
207 * input fields. |address| is a list with one item, an associative array 179 * input fields. |address| is a list with one item, an associative array
208 * that contains the address data. 180 * that contains the address data.
209 * @private 181 * @private
210 */ 182 */
211 showEditAddressOverlay_: function(address) { 183 showEditAddressOverlay_: function(address) {
212 var title = loadTimeData.getString('editAddressTitle'); 184 var title = loadTimeData.getString('editAddressTitle');
213 AutofillEditAddressOverlay.setTitle(title); 185 AutofillEditAddressOverlay.setTitle(title);
214 AutofillEditAddressOverlay.loadAddress(address); 186 AutofillEditAddressOverlay.loadAddress(address);
215 PageManager.showPageByName('autofillEditAddress'); 187 PageManager.showPageByName('autofillEditAddress');
(...skipping 29 matching lines...) Expand all
245 }; 217 };
246 218
247 AutofillOptions.setCreditCardList = function(entries) { 219 AutofillOptions.setCreditCardList = function(entries) {
248 AutofillOptions.getInstance().setCreditCardList_(entries); 220 AutofillOptions.getInstance().setCreditCardList_(entries);
249 }; 221 };
250 222
251 AutofillOptions.removeData = function(guid, metricsAction) { 223 AutofillOptions.removeData = function(guid, metricsAction) {
252 AutofillOptions.getInstance().removeData_(guid, metricsAction); 224 AutofillOptions.getInstance().removeData_(guid, metricsAction);
253 }; 225 };
254 226
255 AutofillOptions.loadAddressEditor = function(entry) {
256 AutofillOptions.getInstance().loadAddressEditor_(entry);
257 };
258
259 AutofillOptions.loadCreditCardEditor = function(entry) {
260 AutofillOptions.getInstance().loadCreditCardEditor_(entry);
261 };
262
263 AutofillOptions.editAddress = function(address) { 227 AutofillOptions.editAddress = function(address) {
264 AutofillOptions.getInstance().showEditAddressOverlay_(address); 228 AutofillOptions.getInstance().showEditAddressOverlay_(address);
265 }; 229 };
266 230
267 AutofillOptions.walletIntegrationAvailableStateChanged = function(available) { 231 AutofillOptions.walletIntegrationAvailableStateChanged = function(available) {
268 AutofillOptions.getInstance(). 232 AutofillOptions.getInstance().
269 walletIntegrationAvailableStateChanged_(available); 233 walletIntegrationAvailableStateChanged_(available);
270 }; 234 };
271 235
272 /** 236 /**
273 * @param {CreditCardData} creditCard 237 * @param {CreditCardData} creditCard
274 */ 238 */
275 AutofillOptions.editCreditCard = function(creditCard) { 239 AutofillOptions.editCreditCard = function(creditCard) {
276 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard); 240 AutofillOptions.getInstance().showEditCreditCardOverlay_(creditCard);
277 }; 241 };
278 242
279 // Export 243 // Export
280 return { 244 return {
281 AutofillOptions: AutofillOptions 245 AutofillOptions: AutofillOptions
282 }; 246 };
283 247
284 }); 248 });
285 249
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/autofill_options_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698