Chromium Code Reviews| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 */ | 137 */ |
| 138 getCreditCardList: assertNotReached, | 138 getCreditCardList: assertNotReached, |
| 139 | 139 |
| 140 /** | 140 /** |
| 141 * @param {!AutofillManager.CreditCardEntry} creditCard The credit card to | 141 * @param {!AutofillManager.CreditCardEntry} creditCard The credit card to |
| 142 * remove. | 142 * remove. |
| 143 */ | 143 */ |
| 144 removeCreditCard: assertNotReached, | 144 removeCreditCard: assertNotReached, |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @param {!AutofillManager.CreditCardEntry} creditCard The credit card to | |
| 148 * remove from the local cache. | |
| 149 */ | |
| 150 clearCachedCreditCard: assertNotReached, | |
| 151 | |
| 152 /** | |
| 147 * Saves the given credit card. | 153 * Saves the given credit card. |
| 148 * @param {!AutofillManager.CreditCardEntry} creditCard | 154 * @param {!AutofillManager.CreditCardEntry} creditCard |
| 149 */ | 155 */ |
| 150 saveCreditCard: assertNotReached, | 156 saveCreditCard: assertNotReached, |
| 151 }; | 157 }; |
| 152 | 158 |
| 153 /** | 159 /** |
| 154 * Implementation that accesses the private API. | 160 * Implementation that accesses the private API. |
| 155 * @implements {PasswordManager} | 161 * @implements {PasswordManager} |
| 156 * @constructor | 162 * @constructor |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 265 getCreditCardList: function(callback) { | 271 getCreditCardList: function(callback) { |
| 266 chrome.autofillPrivate.getCreditCardList(callback); | 272 chrome.autofillPrivate.getCreditCardList(callback); |
| 267 }, | 273 }, |
| 268 | 274 |
| 269 /** @override */ | 275 /** @override */ |
| 270 removeCreditCard: function(creditCard) { | 276 removeCreditCard: function(creditCard) { |
| 271 chrome.autofillPrivate.removeEntry(/** @type {string} */(creditCard.guid)); | 277 chrome.autofillPrivate.removeEntry(/** @type {string} */(creditCard.guid)); |
| 272 }, | 278 }, |
| 273 | 279 |
| 274 /** @override */ | 280 /** @override */ |
| 281 clearCachedCreditCard: function(creditCard) { | |
| 282 chrome.autofillPrivate.maskCreditCard( | |
| 283 /** @type {string} */(creditCard.guid)); | |
|
tommycli
2016/06/25 00:36:01
These typecasts seem interesting. Are these variab
hcarmona
2016/06/27 22:22:32
Tried something else. WDYT?
| |
| 284 }, | |
| 285 | |
| 286 /** @override */ | |
| 275 saveCreditCard: function(creditCard) { | 287 saveCreditCard: function(creditCard) { |
| 276 chrome.autofillPrivate.saveCreditCard(creditCard); | 288 chrome.autofillPrivate.saveCreditCard(creditCard); |
| 277 } | 289 } |
| 278 }; | 290 }; |
| 279 | 291 |
| 280 (function() { | 292 (function() { |
| 281 'use strict'; | 293 'use strict'; |
| 282 | 294 |
| 283 Polymer({ | 295 Polymer({ |
| 284 is: 'settings-passwords-and-forms-page', | 296 is: 'settings-passwords-and-forms-page', |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 addresses: Array, | 331 addresses: Array, |
| 320 | 332 |
| 321 /** | 333 /** |
| 322 * An array of saved addresses. | 334 * An array of saved addresses. |
| 323 * @type {!Array<!AutofillManager.CreditCardEntry>} | 335 * @type {!Array<!AutofillManager.CreditCardEntry>} |
| 324 */ | 336 */ |
| 325 creditCards: Array, | 337 creditCards: Array, |
| 326 }, | 338 }, |
| 327 | 339 |
| 328 listeners: { | 340 listeners: { |
| 341 'clear-credit-card': 'clearCreditCard_', | |
| 329 'remove-address': 'removeAddress_', | 342 'remove-address': 'removeAddress_', |
| 330 'remove-credit-card': 'removeCreditCard_', | 343 'remove-credit-card': 'removeCreditCard_', |
| 331 'remove-password-exception': 'removePasswordException_', | 344 'remove-password-exception': 'removePasswordException_', |
| 332 'remove-saved-password': 'removeSavedPassword_', | 345 'remove-saved-password': 'removeSavedPassword_', |
| 333 'save-credit-card': 'saveCreditCard_', | 346 'save-credit-card': 'saveCreditCard_', |
| 334 'show-password': 'showPassword_', | 347 'show-password': 'showPassword_', |
| 335 }, | 348 }, |
| 336 | 349 |
| 337 /** @type {?function(!Array<PasswordManager.PasswordUiEntry>):void} */ | 350 /** @type {?function(!Array<PasswordManager.PasswordUiEntry>):void} */ |
| 338 setSavedPasswordsListener_: null, | 351 setSavedPasswordsListener_: null, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 /** | 441 /** |
| 429 * Listens for the remove-credit-card event, and calls the private API. | 442 * Listens for the remove-credit-card event, and calls the private API. |
| 430 * @param {!Event} event | 443 * @param {!Event} event |
| 431 * @private | 444 * @private |
| 432 */ | 445 */ |
| 433 removeCreditCard_: function(event) { | 446 removeCreditCard_: function(event) { |
| 434 this.autofillManager_.removeCreditCard(event.detail); | 447 this.autofillManager_.removeCreditCard(event.detail); |
| 435 }, | 448 }, |
| 436 | 449 |
| 437 /** | 450 /** |
| 451 * Listens for the clear-credit-card event, and calls the private API. | |
| 452 * @param {!Event} event | |
| 453 * @private | |
| 454 */ | |
| 455 clearCreditCard_: function(event) { | |
| 456 this.autofillManager_.clearCachedCreditCard(event.detail); | |
| 457 }, | |
| 458 | |
| 459 /** | |
| 438 * Shows the manage autofill sub page. | 460 * Shows the manage autofill sub page. |
| 439 * @param {!Event} event | 461 * @param {!Event} event |
| 440 * @private | 462 * @private |
| 441 */ | 463 */ |
| 442 onAutofillTap_: function(event) { | 464 onAutofillTap_: function(event) { |
| 443 // Ignore clicking on the toggle button and verify autofill is enabled. | 465 // Ignore clicking on the toggle button and verify autofill is enabled. |
| 444 if (Polymer.dom(event).localTarget != this.$.autofillToggle && | 466 if (Polymer.dom(event).localTarget != this.$.autofillToggle && |
| 445 this.getPref('autofill.enabled').value) { | 467 this.getPref('autofill.enabled').value) { |
| 446 this.$.pages.setSubpageChain(['manage-autofill']); | 468 this.$.pages.setSubpageChain(['manage-autofill']); |
| 447 } | 469 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 475 * @param {!Event} event | 497 * @param {!Event} event |
| 476 * @private | 498 * @private |
| 477 */ | 499 */ |
| 478 showPassword_: function(event) { | 500 showPassword_: function(event) { |
| 479 this.passwordManager_.getPlaintextPassword(event.detail, function(e) { | 501 this.passwordManager_.getPlaintextPassword(event.detail, function(e) { |
| 480 this.$$('#passwordSection').setPassword(e.loginPair, e.plaintextPassword); | 502 this.$$('#passwordSection').setPassword(e.loginPair, e.plaintextPassword); |
| 481 }.bind(this)); | 503 }.bind(this)); |
| 482 }, | 504 }, |
| 483 }); | 505 }); |
| 484 })(); | 506 })(); |
| OLD | NEW |