OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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-autofill-section' is the section containing saved | 6 * @fileoverview 'settings-autofill-section' is the section containing saved |
7 * addresses and credit cards for use in autofill. | 7 * addresses and credit cards for use in autofill. |
8 */ | 8 */ |
9 (function() { | 9 (function() { |
10 'use strict'; | 10 'use strict'; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 * @private | 112 * @private |
113 */ | 113 */ |
114 onCreditCardMenuTap_: function(e) { | 114 onCreditCardMenuTap_: function(e) { |
115 // Close the other menu. | 115 // Close the other menu. |
116 this.$.addressSharedMenu.closeMenu(); | 116 this.$.addressSharedMenu.closeMenu(); |
117 | 117 |
118 var menuEvent = /** @type {!{model: !{item: !Object}}} */(e); | 118 var menuEvent = /** @type {!{model: !{item: !Object}}} */(e); |
119 var creditCard = /** @type {!chrome.autofillPrivate.CreditCardEntry} */( | 119 var creditCard = /** @type {!chrome.autofillPrivate.CreditCardEntry} */( |
120 menuEvent.model.item); | 120 menuEvent.model.item); |
121 this.$.menuRemoveCreditCard.hidden = !creditCard.metadata.isLocal; | 121 this.$.menuRemoveCreditCard.hidden = !creditCard.metadata.isLocal; |
| 122 this.$.menuClearCreditCard.hidden = !creditCard.metadata.isCached; |
122 this.$.creditCardSharedMenu.toggleMenu( | 123 this.$.creditCardSharedMenu.toggleMenu( |
123 Polymer.dom(e).localTarget, creditCard); | 124 Polymer.dom(e).localTarget, creditCard); |
124 e.stopPropagation(); // Prevent the tap event from closing the menu. | 125 e.stopPropagation(); // Prevent the tap event from closing the menu. |
125 }, | 126 }, |
126 | 127 |
127 /** | 128 /** |
128 * Handles tapping on the "Add credit card" button. | 129 * Handles tapping on the "Add credit card" button. |
129 * @param {!Event} e | 130 * @param {!Event} e |
130 * @private | 131 * @private |
131 */ | 132 */ |
(...skipping 29 matching lines...) Expand all Loading... |
161 * Handles tapping on the "Remove" credit card button. | 162 * Handles tapping on the "Remove" credit card button. |
162 * @private | 163 * @private |
163 */ | 164 */ |
164 onMenuRemoveCreditCardTap_: function() { | 165 onMenuRemoveCreditCardTap_: function() { |
165 var menu = this.$.creditCardSharedMenu; | 166 var menu = this.$.creditCardSharedMenu; |
166 this.fire('remove-credit-card', menu.itemData); | 167 this.fire('remove-credit-card', menu.itemData); |
167 menu.closeMenu(); | 168 menu.closeMenu(); |
168 }, | 169 }, |
169 | 170 |
170 /** | 171 /** |
| 172 * Handles tapping on the "Clear copy" button for cached credit cards. |
| 173 * @private |
| 174 */ |
| 175 onMenuClearCreditCardTap_: function() { |
| 176 var menu = this.$.creditCardSharedMenu; |
| 177 this.fire('clear-credit-card', menu.itemData); |
| 178 menu.closeMenu(); |
| 179 }, |
| 180 |
| 181 /** |
171 * Closes the overflow menus. | 182 * Closes the overflow menus. |
172 * @private | 183 * @private |
173 */ | 184 */ |
174 closeMenu_: function() { | 185 closeMenu_: function() { |
175 this.$.addressSharedMenu.closeMenu(); | 186 this.$.addressSharedMenu.closeMenu(); |
176 this.$.creditCardSharedMenu.closeMenu(); | 187 this.$.creditCardSharedMenu.closeMenu(); |
177 }, | 188 }, |
178 }); | 189 }); |
179 })(); | 190 })(); |
OLD | NEW |