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

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

Issue 2430463002: MD Settings: tweak some chrome.settingsPrivate method names (Closed)
Patch Set: histograms.xml Created 4 years, 2 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 * '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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 {value: 12, name: loadTimeData.getString('small')}, 47 {value: 12, name: loadTimeData.getString('small')},
48 {value: 16, name: loadTimeData.getString('medium')}, 48 {value: 16, name: loadTimeData.getString('medium')},
49 {value: 20, name: loadTimeData.getString('large')}, 49 {value: 20, name: loadTimeData.getString('large')},
50 {value: 24, name: loadTimeData.getString('veryLarge')}, 50 {value: 24, name: loadTimeData.getString('veryLarge')},
51 ]; 51 ];
52 }, 52 },
53 }, 53 },
54 54
55 /** 55 /**
56 * List of options for the page zoom drop-down menu. 56 * List of options for the page zoom drop-down menu.
57 * @type {!DropdownMenuOptionList} 57 * @type {!Array<number>}
58 */ 58 */
59 pageZoomLevels_: { 59 pageZoomLevels_: {
60 readOnly: true, 60 readOnly: true,
61 type: Array, 61 type: Array,
62 value: [ 62 value: [
63 // TODO(dbeam): get these dynamically from C++ instead. 63 // TODO(dbeam): get these dynamically from C++ instead.
64 1 / 4, 64 1 / 4,
65 1 / 3, 65 1 / 3,
66 1 / 2, 66 1 / 2,
67 2 / 3, 67 2 / 3,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ], 104 ],
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.getDefaultZoomPercent(function(value) { 114 chrome.settingsPrivate.getDefaultZoom(function(zoom) {
115 // TODO(dpapad): Non-integer values will cause no <option> to be selected 115 this.$.zoomLevel.value = zoom;
116 // until crbug.com/655742 is addressed.
117 this.$.zoomLevel.value = value;
118 }.bind(this)); 116 }.bind(this));
119 }, 117 },
120 118
121 /** 119 /**
122 * @param {number} zoom 120 * @param {number} zoom
123 * @return {number} A zoom easier read by users. 121 * @return {number} A zoom easier read by users.
122 * @private
124 */ 123 */
125 formatZoom_: function(zoom) { 124 formatZoom_: function(zoom) {
126 return Math.round(zoom * 100); 125 return Math.round(zoom * 100);
127 }, 126 },
128 127
129 /** 128 /**
130 * @param {boolean} isNtp Whether to use the NTP as the home page. 129 * @param {boolean} isNtp Whether to use the NTP as the home page.
131 * @param {string} homepage If not using NTP, use this URL. 130 * @param {string} homepage If not using NTP, use this URL.
132 * @return {string} The sub-label. 131 * @return {string} The sub-label.
133 * @private 132 * @private
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 </if> 220 </if>
222 <if expr="not is_linux or chromeos"> 221 <if expr="not is_linux or chromeos">
223 i18nId = 'chooseFromWebStore'; 222 i18nId = 'chooseFromWebStore';
224 </if> 223 </if>
225 this.themeSublabel_ = this.i18n(i18nId); 224 this.themeSublabel_ = this.i18n(i18nId);
226 this.themeUrl_ = ''; 225 this.themeUrl_ = '';
227 }, 226 },
228 227
229 /** @private */ 228 /** @private */
230 onZoomLevelChange_: function() { 229 onZoomLevelChange_: function() {
231 chrome.settingsPrivate.setDefaultZoomPercent( 230 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value));
232 parseFloat(this.$.zoomLevel.value));
233 }, 231 },
234 232
235 /** 233 /**
236 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. 234 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible.
237 * @return {string} 'first' if the argument is false or empty otherwise. 235 * @return {string} 'first' if the argument is false or empty otherwise.
238 * @private 236 * @private
239 */ 237 */
240 getFirst_: function(bookmarksBarVisible) { 238 getFirst_: function(bookmarksBarVisible) {
241 return !bookmarksBarVisible ? 'first' : ''; 239 return !bookmarksBarVisible ? 'first' : '';
242 } 240 }
243 }); 241 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698