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

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

Issue 2488113002: MD Settings: [further] robustify default zoom level handling (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 'settings-appearance-page' is the settings page containing appearance 6 * 'settings-appearance-page' is the settings page containing appearance
7 * settings. 7 * settings.
8 * 8 *
9 * Example: 9 * Example:
10 * 10 *
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 created: function() { 106 created: function() {
107 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); 107 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance();
108 }, 108 },
109 109
110 ready: function() { 110 ready: function() {
111 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 111 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
112 // TODO(dschuyler): Look into adding a listener for the 112 // TODO(dschuyler): Look into adding a listener for the
113 // default zoom percent. 113 // default zoom percent.
114 chrome.settingsPrivate.getDefaultZoom(function(zoom) { 114 chrome.settingsPrivate.getDefaultZoom(function(zoom) {
115 this.$.zoomLevel.value = zoom; 115 assert(this.pageZoomLevels_.length == this.$.zoomLevel.options.length);
116 for (var i = 0; i < this.pageZoomLevels_.length; ++i) {
dpapad 2016/11/10 00:30:58 If we have to iterate over zoom levels, would it m
Dan Beam 2016/11/10 01:22:11 Done.
117 // See content::ZoomValuesEqual().
118 if (Math.abs(this.pageZoomLevels_[i] - zoom) <= 0.001) {
119 this.$.zoomLevel.selectedIndex = i;
120 return;
121 }
122 }
123 assertNotReached();
116 }.bind(this)); 124 }.bind(this));
117 }, 125 },
118 126
119 /** 127 /**
120 * @param {number} zoom 128 * @param {number} zoom
121 * @return {number} A zoom easier read by users. 129 * @return {number} A zoom easier read by users.
122 * @private 130 * @private
123 */ 131 */
124 formatZoom_: function(zoom) { 132 formatZoom_: function(zoom) {
125 return Math.round(zoom * 100); 133 return Math.round(zoom * 100);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 252
245 /** 253 /**
246 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. 254 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible.
247 * @return {string} 'first' if the argument is false or empty otherwise. 255 * @return {string} 'first' if the argument is false or empty otherwise.
248 * @private 256 * @private
249 */ 257 */
250 getFirst_: function(bookmarksBarVisible) { 258 getFirst_: function(bookmarksBarVisible) {
251 return !bookmarksBarVisible ? 'first' : ''; 259 return !bookmarksBarVisible ? 'first' : '';
252 } 260 }
253 }); 261 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698