Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/resources/settings/site_settings/zoom_levels.js

Issue 2630583002: Add setting to isolate zoom changes by default. (Closed)
Patch Set: ... and tell closure_compiler. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 as well as the zoom scope setting.
9 */ 9 */
10 10
11 Polymer({ 11 Polymer({
12 is: 'zoom-levels', 12 is: 'zoom-levels',
13 13
14 behaviors: [SiteSettingsBehavior, WebUIListenerBehavior], 14 behaviors: [I18nBehavior, SiteSettingsBehavior, WebUIListenerBehavior],
15 15
16 properties: { 16 properties: {
17 /** 17 /**
18 * Whether zoom changes are applied on a per-site basis or a per-tab basis.
19 * @type {boolean}
20 */
21 zoomScopeIsPerOrigin_: {
22 type: Boolean,
23 value: true,
24 },
25
26 /**
18 * Array of sites that are zoomed in or out. 27 * Array of sites that are zoomed in or out.
19 * @type {!Array<ZoomLevelEntry>} 28 * @type {!Array<ZoomLevelEntry>}
20 */ 29 */
21 sites_: Array, 30 sites_: Array,
31
32 /** @private */
33 isGuest_: {
34 type: Boolean,
35 value: function() { return loadTimeData.getBoolean('isGuest'); }
36 },
22 }, 37 },
23 38
24 ready: function() { 39 ready: function() {
40 this.addWebUIListener('onZoomScopeChanged',
41 this.onZoomScopeChanged_.bind(this));
25 this.addWebUIListener('onZoomLevelsChanged', 42 this.addWebUIListener('onZoomLevelsChanged',
26 this.onZoomLevelsChanged_.bind(this)); 43 this.onZoomLevelsChanged_.bind(this));
44 this.browserProxy.fetchZoomScope();
27 this.browserProxy.fetchZoomLevels(); 45 this.browserProxy.fetchZoomLevels();
28 }, 46 },
29 47
30 /** 48 /**
49 * A handler for when the zoom scope changes.
50 * @param {boolean} zoomScopeIsPerOrigin The zoom scope setting.
51 */
52 onZoomScopeChanged_: function(zoomScopeIsPerOrigin) {
53 this.zoomScopeIsPerOrigin_ = zoomScopeIsPerOrigin;
54 },
55
56 /**
31 * A handler for when zoom levels change. 57 * A handler for when zoom levels change.
32 * @param {!Array<ZoomLevelEntry>} sites The up to date list of sites and 58 * @param {!Array<ZoomLevelEntry>} sites The up to date list of sites and
33 * their zoom levels. 59 * their zoom levels.
34 */ 60 */
35 onZoomLevelsChanged_: function(sites) { 61 onZoomLevelsChanged_: function(sites) {
36 this.sites_ = sites; 62 this.sites_ = sites;
37 }, 63 },
38 64
39 /** 65 /**
66 * Returns the label for the zoom scope toggle.
67 * @private
68 */
69 getScopeLabel_: function(zoomScopeIsPerOrigin) {
70 return zoomScopeIsPerOrigin ? this.i18n('siteSettingsZoomScopeOrigin')
71 : this.i18n('siteSettingsZoomScopeTab');
72 },
73
74 /**
75 * Whether to show the text indicating that there are no zoomed sites.
76 * @private
77 */
78 showNoZoomedSites_: function(renderedCount, zoomScopeIsPerOrigin) {
79 return renderedCount == 0 && zoomScopeIsPerOrigin;
80 },
81
82 /**
83 * A handler for when the user toggles the zoom scope.
84 * @private
85 */
86 toggleZoomScope_: function() {
87 this.browserProxy.setZoomScopeIsPerOrigin(this.zoomScopeIsPerOrigin_);
88 },
89
90 /**
40 * A handler for when a zoom level for a site is deleted. 91 * A handler for when a zoom level for a site is deleted.
41 * @param {!{model: !{index: number}}} event 92 * @param {!{model: !{index: number}}} event
42 * @private 93 * @private
43 */ 94 */
44 removeZoomLevel_: function(event) { 95 removeZoomLevel_: function(event) {
45 var site = this.sites_[event.model.index]; 96 var site = this.sites_[event.model.index];
46 this.browserProxy.removeZoomLevel(site.origin); 97 this.browserProxy.removeZoomLevel(site.origin);
47 }, 98 },
48 }); 99 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/site_settings/zoom_levels.html ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698