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

Side by Side Diff: chrome/browser/resources/settings/appearance_page/appearance_page.js

Issue 2861443003: MD Settings: Fix subpage visibility and add appearance page tests (Closed)
Patch Set: Created 3 years, 7 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 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 /** 6 /**
7 * This is the absolute difference maintained between standard and 7 * This is the absolute difference maintained between standard and
8 * fixed-width font sizes. http://crbug.com/91922. 8 * fixed-width font sizes. http://crbug.com/91922.
9 * @const @private {number} 9 * @const @private {number}
10 */ 10 */
(...skipping 15 matching lines...) Expand all
26 Polymer({ 26 Polymer({
27 is: 'settings-appearance-page', 27 is: 'settings-appearance-page',
28 28
29 behaviors: [I18nBehavior], 29 behaviors: [I18nBehavior],
30 30
31 properties: { 31 properties: {
32 /** 32 /**
33 * Dictionary defining page visibility. 33 * Dictionary defining page visibility.
34 * @type {!AppearancePageVisibility} 34 * @type {!AppearancePageVisibility}
35 */ 35 */
36 pageVisibility: Object, 36 pageVisibility: {
37 type: Object,
38 value: function() {
39 return {};
40 },
41 },
37 42
38 prefs: { 43 prefs: {
39 type: Object, 44 type: Object,
40 notify: true, 45 notify: true,
41 }, 46 },
42 47
43 /** @private */ 48 /** @private */
44 defaultZoom_: Number, 49 defaultZoom_: Number,
45 50
46 /** 51 /**
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ready: function() { 142 ready: function() {
138 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 143 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
139 // TODO(dschuyler): Look into adding a listener for the 144 // TODO(dschuyler): Look into adding a listener for the
140 // default zoom percent. 145 // default zoom percent.
141 this.browserProxy_.getDefaultZoom().then(function(zoom) { 146 this.browserProxy_.getDefaultZoom().then(function(zoom) {
142 this.defaultZoom_ = zoom; 147 this.defaultZoom_ = zoom;
143 }.bind(this)); 148 }.bind(this));
144 }, 149 },
145 150
146 /** 151 /**
152 * @param {boolean|undefined} visibility
153 * @return {boolean}
154 * @private
155 */
156 showPage_: function(visibility) {
157 return visibility !== false;
158 },
159
160 /**
147 * @param {number} zoom 161 * @param {number} zoom
148 * @return {number} A zoom easier read by users. 162 * @return {number} A zoom easier read by users.
149 * @private 163 * @private
150 */ 164 */
151 formatZoom_: function(zoom) { 165 formatZoom_: function(zoom) {
152 return Math.round(zoom * 100); 166 return Math.round(zoom * 100);
153 }, 167 },
154 168
155 /** 169 /**
156 * @param {boolean} showHomepage Whether to show home page. 170 * @param {boolean} showHomepage Whether to show home page.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 this.themeSublabel_ = this.i18n(i18nId); 301 this.themeSublabel_ = this.i18n(i18nId);
288 this.themeUrl_ = ''; 302 this.themeUrl_ = '';
289 }, 303 },
290 304
291 /** @private */ 305 /** @private */
292 onZoomLevelChange_: function() { 306 onZoomLevelChange_: function() {
293 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); 307 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value));
294 }, 308 },
295 309
296 /** 310 /**
297 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible.
298 * @return {string} 'first' if the argument is false or empty otherwise.
299 * @private
300 */
301 getFirst_: function(bookmarksBarVisible) {
302 return !bookmarksBarVisible ? 'first' : '';
303 },
304
305 /**
306 * @see content::ZoomValuesEqual(). 311 * @see content::ZoomValuesEqual().
307 * @param {number} zoom1 312 * @param {number} zoom1
308 * @param {number} zoom2 313 * @param {number} zoom2
309 * @return {boolean} 314 * @return {boolean}
310 * @private 315 * @private
311 */ 316 */
312 zoomValuesEqual_: function(zoom1, zoom2) { 317 zoomValuesEqual_: function(zoom1, zoom2) {
313 return Math.abs(zoom1 - zoom2) <= 0.001; 318 return Math.abs(zoom1 - zoom2) <= 0.001;
314 }, 319 },
315 }); 320 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698