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 | 6 * @fileoverview |
7 * 'site-list' shows a list of Allowed and Blocked sites for a given | 7 * 'site-list' shows a list of Allowed and Blocked sites for a given |
8 * category. | 8 * category. |
9 */ | 9 */ |
10 Polymer({ | 10 Polymer({ |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 onAddSiteTap_: function(e) { | 208 onAddSiteTap_: function(e) { |
209 assert(!this.readOnlyList); | 209 assert(!this.readOnlyList); |
210 e.preventDefault(); | 210 e.preventDefault(); |
211 var dialog = document.createElement('add-site-dialog'); | 211 var dialog = document.createElement('add-site-dialog'); |
212 dialog.category = this.category; | 212 dialog.category = this.category; |
213 dialog.contentSetting = this.categorySubtype; | 213 dialog.contentSetting = this.categorySubtype; |
214 this.shadowRoot.appendChild(dialog); | 214 this.shadowRoot.appendChild(dialog); |
215 | 215 |
216 dialog.open(this.categorySubtype); | 216 dialog.open(this.categorySubtype); |
217 | 217 |
218 dialog.addEventListener('close', function() { | 218 dialog.addEventListener('close', () => { |
219 cr.ui.focusWithoutInk(assert(this.$.addSite)); | 219 cr.ui.focusWithoutInk(assert(this.$.addSite)); |
220 dialog.remove(); | 220 dialog.remove(); |
221 }.bind(this)); | 221 }); |
222 }, | 222 }, |
223 | 223 |
224 /** | 224 /** |
225 * Populate the sites list for display. | 225 * Populate the sites list for display. |
226 * @private | 226 * @private |
227 */ | 227 */ |
228 populateList_: function() { | 228 populateList_: function() { |
229 this.browserProxy_.getExceptionList(this.category) | 229 this.browserProxy_.getExceptionList(this.category).then(exceptionList => { |
230 .then(function(exceptionList) { | 230 this.processExceptions_([exceptionList]); |
231 this.processExceptions_([exceptionList]); | 231 this.closeActionMenu_(); |
232 this.closeActionMenu_(); | 232 }); |
233 }.bind(this)); | |
234 }, | 233 }, |
235 | 234 |
236 /** | 235 /** |
237 * Process the exception list returned from the native layer. | 236 * Process the exception list returned from the native layer. |
238 * @param {!Array<!Array<RawSiteException>>} data List of sites (exceptions) | 237 * @param {!Array<!Array<RawSiteException>>} data List of sites (exceptions) |
239 * to process. | 238 * to process. |
240 * @private | 239 * @private |
241 */ | 240 */ |
242 processExceptions_: function(data) { | 241 processExceptions_: function(data) { |
243 var sites = /** @type {!Array<RawSiteException>} */ ([]); | 242 var sites = /** @type {!Array<RawSiteException>} */ ([]); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 /** @private */ | 429 /** @private */ |
431 closeActionMenu_: function() { | 430 closeActionMenu_: function() { |
432 this.actionMenuSite_ = null; | 431 this.actionMenuSite_ = null; |
433 this.activeDialogAnchor_ = null; | 432 this.activeDialogAnchor_ = null; |
434 var actionMenu = /** @type {!CrActionMenuElement} */ ( | 433 var actionMenu = /** @type {!CrActionMenuElement} */ ( |
435 this.$$('dialog[is=cr-action-menu]')); | 434 this.$$('dialog[is=cr-action-menu]')); |
436 if (actionMenu.open) | 435 if (actionMenu.open) |
437 actionMenu.close(); | 436 actionMenu.close(); |
438 }, | 437 }, |
439 }); | 438 }); |
OLD | NEW |