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