OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @fileoverview 'settings-passwords-and-forms-page' is the settings page | 6 * @fileoverview 'settings-passwords-and-forms-page' is the settings page |
7 * for passwords and auto fill. | 7 * for passwords and auto fill. |
8 */ | 8 */ |
9 | 9 |
10 /** | 10 /** |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener | 109 * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener |
110 */ | 110 */ |
111 removeAddressListChangedListener: assertNotReached, | 111 removeAddressListChangedListener: assertNotReached, |
112 | 112 |
113 /** | 113 /** |
114 * Request the list of addresses. | 114 * Request the list of addresses. |
115 * @param {function(!Array<!AutofillManager.AddressEntry>):void} callback | 115 * @param {function(!Array<!AutofillManager.AddressEntry>):void} callback |
116 */ | 116 */ |
117 getAddressList: assertNotReached, | 117 getAddressList: assertNotReached, |
118 | 118 |
119 /** @param {!AutofillManager.AddressEntry} address The address to remove. */ | 119 /** @param {string} guid The guid of the address to remove. */ |
120 removeAddress: assertNotReached, | 120 removeAddress: assertNotReached, |
121 | 121 |
122 /** | 122 /** |
123 * Add an observer to the list of credit cards. | 123 * Add an observer to the list of credit cards. |
124 * @param {function(!Array<!AutofillManager.CreditCardEntry>):void} listener | 124 * @param {function(!Array<!AutofillManager.CreditCardEntry>):void} listener |
125 */ | 125 */ |
126 addCreditCardListChangedListener: assertNotReached, | 126 addCreditCardListChangedListener: assertNotReached, |
127 | 127 |
128 /** | 128 /** |
129 * Remove an observer from the list of credit cards. | 129 * Remove an observer from the list of credit cards. |
130 * @param {function(!Array<!AutofillManager.CreditCardEntry>):void} listener | 130 * @param {function(!Array<!AutofillManager.CreditCardEntry>):void} listener |
131 */ | 131 */ |
132 removeCreditCardListChangedListener: assertNotReached, | 132 removeCreditCardListChangedListener: assertNotReached, |
133 | 133 |
134 /** | 134 /** |
135 * Request the list of credit cards. | 135 * Request the list of credit cards. |
136 * @param {function(!Array<!AutofillManager.CreditCardEntry>):void} callback | 136 * @param {function(!Array<!AutofillManager.CreditCardEntry>):void} callback |
137 */ | 137 */ |
138 getCreditCardList: assertNotReached, | 138 getCreditCardList: assertNotReached, |
139 | 139 |
140 /** | 140 /** @param {string} guid The GUID of the credit card to remove. */ |
141 * @param {!AutofillManager.CreditCardEntry} creditCard The credit card to | |
142 * remove. | |
143 */ | |
144 removeCreditCard: assertNotReached, | 141 removeCreditCard: assertNotReached, |
145 | 142 |
| 143 /** @param {string} guid The GUID to credit card to remove from the cache. */ |
| 144 clearCachedCreditCard: assertNotReached, |
| 145 |
146 /** | 146 /** |
147 * Saves the given credit card. | 147 * Saves the given credit card. |
148 * @param {!AutofillManager.CreditCardEntry} creditCard | 148 * @param {!AutofillManager.CreditCardEntry} creditCard |
149 */ | 149 */ |
150 saveCreditCard: assertNotReached, | 150 saveCreditCard: assertNotReached, |
151 }; | 151 }; |
152 | 152 |
153 /** | 153 /** |
154 * Implementation that accesses the private API. | 154 * Implementation that accesses the private API. |
155 * @implements {PasswordManager} | 155 * @implements {PasswordManager} |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 removeAddressListChangedListener: function(listener) { | 240 removeAddressListChangedListener: function(listener) { |
241 chrome.autofillPrivate.onAddressListChanged.removeListener(listener); | 241 chrome.autofillPrivate.onAddressListChanged.removeListener(listener); |
242 }, | 242 }, |
243 | 243 |
244 /** @override */ | 244 /** @override */ |
245 getAddressList: function(callback) { | 245 getAddressList: function(callback) { |
246 chrome.autofillPrivate.getAddressList(callback); | 246 chrome.autofillPrivate.getAddressList(callback); |
247 }, | 247 }, |
248 | 248 |
249 /** @override */ | 249 /** @override */ |
250 removeAddress: function(address) { | 250 removeAddress: function(guid) { |
251 chrome.autofillPrivate.removeEntry(/** @type {string} */(address.guid)); | 251 assert(guid); |
| 252 chrome.autofillPrivate.removeEntry(guid); |
252 }, | 253 }, |
253 | 254 |
254 /** @override */ | 255 /** @override */ |
255 addCreditCardListChangedListener: function(listener) { | 256 addCreditCardListChangedListener: function(listener) { |
256 chrome.autofillPrivate.onCreditCardListChanged.addListener(listener); | 257 chrome.autofillPrivate.onCreditCardListChanged.addListener(listener); |
257 }, | 258 }, |
258 | 259 |
259 /** @override */ | 260 /** @override */ |
260 removeCreditCardListChangedListener: function(listener) { | 261 removeCreditCardListChangedListener: function(listener) { |
261 chrome.autofillPrivate.onCreditCardListChanged.removeListener(listener); | 262 chrome.autofillPrivate.onCreditCardListChanged.removeListener(listener); |
262 }, | 263 }, |
263 | 264 |
264 /** @override */ | 265 /** @override */ |
265 getCreditCardList: function(callback) { | 266 getCreditCardList: function(callback) { |
266 chrome.autofillPrivate.getCreditCardList(callback); | 267 chrome.autofillPrivate.getCreditCardList(callback); |
267 }, | 268 }, |
268 | 269 |
269 /** @override */ | 270 /** @override */ |
270 removeCreditCard: function(creditCard) { | 271 removeCreditCard: function(guid) { |
271 chrome.autofillPrivate.removeEntry(/** @type {string} */(creditCard.guid)); | 272 assert(guid); |
| 273 chrome.autofillPrivate.removeEntry(guid); |
272 }, | 274 }, |
273 | 275 |
274 /** @override */ | 276 /** @override */ |
| 277 clearCachedCreditCard: function(guid) { |
| 278 assert(guid); |
| 279 chrome.autofillPrivate.maskCreditCard(guid); |
| 280 }, |
| 281 |
| 282 /** @override */ |
275 saveCreditCard: function(creditCard) { | 283 saveCreditCard: function(creditCard) { |
276 chrome.autofillPrivate.saveCreditCard(creditCard); | 284 chrome.autofillPrivate.saveCreditCard(creditCard); |
277 } | 285 } |
278 }; | 286 }; |
279 | 287 |
280 (function() { | 288 (function() { |
281 'use strict'; | 289 'use strict'; |
282 | 290 |
283 Polymer({ | 291 Polymer({ |
284 is: 'settings-passwords-and-forms-page', | 292 is: 'settings-passwords-and-forms-page', |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 addresses: Array, | 327 addresses: Array, |
320 | 328 |
321 /** | 329 /** |
322 * An array of saved addresses. | 330 * An array of saved addresses. |
323 * @type {!Array<!AutofillManager.CreditCardEntry>} | 331 * @type {!Array<!AutofillManager.CreditCardEntry>} |
324 */ | 332 */ |
325 creditCards: Array, | 333 creditCards: Array, |
326 }, | 334 }, |
327 | 335 |
328 listeners: { | 336 listeners: { |
| 337 'clear-credit-card': 'clearCreditCard_', |
329 'remove-address': 'removeAddress_', | 338 'remove-address': 'removeAddress_', |
330 'remove-credit-card': 'removeCreditCard_', | 339 'remove-credit-card': 'removeCreditCard_', |
331 'remove-password-exception': 'removePasswordException_', | 340 'remove-password-exception': 'removePasswordException_', |
332 'remove-saved-password': 'removeSavedPassword_', | 341 'remove-saved-password': 'removeSavedPassword_', |
333 'save-credit-card': 'saveCreditCard_', | 342 'save-credit-card': 'saveCreditCard_', |
334 'show-password': 'showPassword_', | 343 'show-password': 'showPassword_', |
335 }, | 344 }, |
336 | 345 |
337 /** @type {?function(!Array<PasswordManager.PasswordUiEntry>):void} */ | 346 /** @type {?function(!Array<PasswordManager.PasswordUiEntry>):void} */ |
338 setSavedPasswordsListener_: null, | 347 setSavedPasswordsListener_: null, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 removeSavedPassword_: function(event) { | 424 removeSavedPassword_: function(event) { |
416 this.passwordManager_.removeSavedPassword(event.detail); | 425 this.passwordManager_.removeSavedPassword(event.detail); |
417 }, | 426 }, |
418 | 427 |
419 /** | 428 /** |
420 * Listens for the remove-address event, and calls the private API. | 429 * Listens for the remove-address event, and calls the private API. |
421 * @param {!Event} event | 430 * @param {!Event} event |
422 * @private | 431 * @private |
423 */ | 432 */ |
424 removeAddress_: function(event) { | 433 removeAddress_: function(event) { |
425 this.autofillManager_.removeAddress(event.detail); | 434 this.autofillManager_.removeAddress(event.detail.guid); |
426 }, | 435 }, |
427 | 436 |
428 /** | 437 /** |
429 * Listens for the remove-credit-card event, and calls the private API. | 438 * Listens for the remove-credit-card event, and calls the private API. |
430 * @param {!Event} event | 439 * @param {!Event} event |
431 * @private | 440 * @private |
432 */ | 441 */ |
433 removeCreditCard_: function(event) { | 442 removeCreditCard_: function(event) { |
434 this.autofillManager_.removeCreditCard(event.detail); | 443 this.autofillManager_.removeCreditCard(event.detail.guid); |
435 }, | 444 }, |
436 | 445 |
437 /** | 446 /** |
| 447 * Listens for the clear-credit-card event, and calls the private API. |
| 448 * @param {!Event} event |
| 449 * @private |
| 450 */ |
| 451 clearCreditCard_: function(event) { |
| 452 this.autofillManager_.clearCachedCreditCard(event.detail.guid); |
| 453 }, |
| 454 |
| 455 /** |
438 * Shows the manage autofill sub page. | 456 * Shows the manage autofill sub page. |
439 * @param {!Event} event | 457 * @param {!Event} event |
440 * @private | 458 * @private |
441 */ | 459 */ |
442 onAutofillTap_: function(event) { | 460 onAutofillTap_: function(event) { |
443 // Ignore clicking on the toggle button and verify autofill is enabled. | 461 // Ignore clicking on the toggle button and verify autofill is enabled. |
444 if (Polymer.dom(event).localTarget != this.$.autofillToggle && | 462 if (Polymer.dom(event).localTarget != this.$.autofillToggle && |
445 this.getPref('autofill.enabled').value) { | 463 this.getPref('autofill.enabled').value) { |
446 this.$.pages.setSubpageChain(['manage-autofill']); | 464 this.$.pages.setSubpageChain(['manage-autofill']); |
447 } | 465 } |
(...skipping 27 matching lines...) Expand all Loading... |
475 * @param {!Event} event | 493 * @param {!Event} event |
476 * @private | 494 * @private |
477 */ | 495 */ |
478 showPassword_: function(event) { | 496 showPassword_: function(event) { |
479 this.passwordManager_.getPlaintextPassword(event.detail, function(e) { | 497 this.passwordManager_.getPlaintextPassword(event.detail, function(e) { |
480 this.$$('#passwordSection').setPassword(e.loginPair, e.plaintextPassword); | 498 this.$$('#passwordSection').setPassword(e.loginPair, e.plaintextPassword); |
481 }.bind(this)); | 499 }.bind(this)); |
482 }, | 500 }, |
483 }); | 501 }); |
484 })(); | 502 })(); |
OLD | NEW |