| 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 | 6 * @fileoverview |
| 7 * 'zoom-levels' is the polymer element for showing the sites that are zoomed in | 7 * 'zoom-levels' is the polymer element for showing the sites that are zoomed in |
| 8 * or out. | 8 * or out. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 Polymer({ | 11 Polymer({ |
| 12 is: 'zoom-levels', | 12 is: 'zoom-levels', |
| 13 | 13 |
| 14 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], | 14 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], |
| 15 | 15 |
| 16 properties: { | 16 properties: { |
| 17 /** | 17 /** |
| 18 * Array of sites that are zoomed in or out. | 18 * Array of sites that are zoomed in or out. |
| 19 * @type {!Array<ZoomLevelEntry>} | 19 * @type {!Array<ZoomLevelEntry>} |
| 20 */ | 20 */ |
| 21 sites_: Array, | 21 sites_: Array, |
| 22 }, | 22 }, |
| 23 | 23 |
| 24 /** @override */ | 24 /** @override */ |
| 25 ready: function() { | 25 ready: function() { |
| 26 this.addWebUIListener('onZoomLevelsChanged', | 26 this.addWebUIListener( |
| 27 this.onZoomLevelsChanged_.bind(this)); | 27 'onZoomLevelsChanged', this.onZoomLevelsChanged_.bind(this)); |
| 28 this.browserProxy.fetchZoomLevels(); | 28 this.browserProxy.fetchZoomLevels(); |
| 29 }, | 29 }, |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * A handler for when zoom levels change. | 32 * A handler for when zoom levels change. |
| 33 * @param {!Array<ZoomLevelEntry>} sites The up to date list of sites and | 33 * @param {!Array<ZoomLevelEntry>} sites The up to date list of sites and |
| 34 * their zoom levels. | 34 * their zoom levels. |
| 35 */ | 35 */ |
| 36 onZoomLevelsChanged_: function(sites) { | 36 onZoomLevelsChanged_: function(sites) { |
| 37 this.sites_ = sites; | 37 this.sites_ = sites; |
| 38 }, | 38 }, |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * A handler for when a zoom level for a site is deleted. | 41 * A handler for when a zoom level for a site is deleted. |
| 42 * @param {!{model: !{index: number}}} event | 42 * @param {!{model: !{index: number}}} event |
| 43 * @private | 43 * @private |
| 44 */ | 44 */ |
| 45 removeZoomLevel_: function(event) { | 45 removeZoomLevel_: function(event) { |
| 46 var site = this.sites_[event.model.index]; | 46 var site = this.sites_[event.model.index]; |
| 47 this.browserProxy.removeZoomLevel(site.origin); | 47 this.browserProxy.removeZoomLevel(site.origin); |
| 48 }, | 48 }, |
| 49 }); | 49 }); |
| OLD | NEW |