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

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: Rebase 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ready: function() { 137 ready: function() {
138 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 138 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
139 // TODO(dschuyler): Look into adding a listener for the 139 // TODO(dschuyler): Look into adding a listener for the
140 // default zoom percent. 140 // default zoom percent.
141 this.browserProxy_.getDefaultZoom().then(function(zoom) { 141 this.browserProxy_.getDefaultZoom().then(function(zoom) {
142 this.defaultZoom_ = zoom; 142 this.defaultZoom_ = zoom;
143 }.bind(this)); 143 }.bind(this));
144 }, 144 },
145 145
146 /** 146 /**
147 * @param {boolean|undefined} visibility
148 * @return {boolean}
149 * @private
150 */
151 showPage_: function(visibility) {
152 return visibility !== false;
153 },
154
155 /**
147 * @param {number} zoom 156 * @param {number} zoom
148 * @return {number} A zoom easier read by users. 157 * @return {number} A zoom easier read by users.
149 * @private 158 * @private
150 */ 159 */
151 formatZoom_: function(zoom) { 160 formatZoom_: function(zoom) {
152 return Math.round(zoom * 100); 161 return Math.round(zoom * 100);
153 }, 162 },
154 163
155 /** 164 /**
156 * @param {boolean} showHomepage Whether to show home page. 165 * @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); 296 this.themeSublabel_ = this.i18n(i18nId);
288 this.themeUrl_ = ''; 297 this.themeUrl_ = '';
289 }, 298 },
290 299
291 /** @private */ 300 /** @private */
292 onZoomLevelChange_: function() { 301 onZoomLevelChange_: function() {
293 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); 302 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value));
294 }, 303 },
295 304
296 /** 305 /**
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(). 306 * @see content::ZoomValuesEqual().
307 * @param {number} zoom1 307 * @param {number} zoom1
308 * @param {number} zoom2 308 * @param {number} zoom2
309 * @return {boolean} 309 * @return {boolean}
310 * @private 310 * @private
311 */ 311 */
312 zoomValuesEqual_: function(zoom1, zoom2) { 312 zoomValuesEqual_: function(zoom1, zoom2) {
313 return Math.abs(zoom1 - zoom2) <= 0.001; 313 return Math.abs(zoom1 - zoom2) <= 0.001;
314 }, 314 },
315 }); 315 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698