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

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

Issue 2403353002: MD Settings: Stop calling chrome.settingsPrivate.setDefaultZoomLevel on startup. (Closed)
Patch Set: More 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
« no previous file with comments | « chrome/browser/resources/settings/appearance_page/appearance_page.html ('k') | 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 16 matching lines...) Expand all
27 type: Object, 27 type: Object,
28 notify: true, 28 notify: true,
29 }, 29 },
30 30
31 /** @private */ 31 /** @private */
32 useSystemTheme_: { 32 useSystemTheme_: {
33 type: Boolean, 33 type: Boolean,
34 value: false, // Can only be true on Linux, but value exists everywhere. 34 value: false, // Can only be true on Linux, but value exists everywhere.
35 }, 35 },
36 36
37 /** @private */
38 defaultZoomLevel_: {
39 notify: true,
40 type: Object,
41 value: function() {
42 return {
43 type: chrome.settingsPrivate.PrefType.NUMBER,
44 };
45 },
46 },
47
48 /** 37 /**
49 * List of options for the font size drop-down menu. 38 * List of options for the font size drop-down menu.
50 * @type {!DropdownMenuOptionList} 39 * @type {!DropdownMenuOptionList}
51 */ 40 */
52 fontSizeOptions_: { 41 fontSizeOptions_: {
53 readOnly: true, 42 readOnly: true,
54 type: Array, 43 type: Array,
55 value: function() { 44 value: function() {
56 return [ 45 return [
57 {value: 9, name: loadTimeData.getString('verySmall')}, 46 {value: 9, name: loadTimeData.getString('verySmall')},
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 /** @private {string} */ 93 /** @private {string} */
105 themeUrl_: '', 94 themeUrl_: '',
106 95
107 observers: [ 96 observers: [
108 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', 97 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)',
109 98
110 <if expr="is_linux and not chromeos"> 99 <if expr="is_linux and not chromeos">
111 // NOTE: this pref only exists on Linux. 100 // NOTE: this pref only exists on Linux.
112 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', 101 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)',
113 </if> 102 </if>
114
115 'zoomLevelChanged_(defaultZoomLevel_.value)',
116 ], 103 ],
117 104
118 created: function() { 105 created: function() {
119 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); 106 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance();
120 }, 107 },
121 108
122 ready: function() { 109 ready: function() {
123 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 110 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
124 this.$.pageZoom.menuOptions = this.pageZoomOptions_;
125 // TODO(dschuyler): Look into adding a listener for the 111 // TODO(dschuyler): Look into adding a listener for the
126 // default zoom percent. 112 // default zoom percent.
127 chrome.settingsPrivate.getDefaultZoomPercent( 113 chrome.settingsPrivate.getDefaultZoomPercent(function(value) {
128 this.zoomPrefChanged_.bind(this)); 114 // TODO(dpapad): Non-integer values will cause no <option> to be selected
115 // until crbug.com/655742 is addressed.
116 this.$.zoomLevel.value = value;
117 }.bind(this));
129 }, 118 },
130 119
131 /** 120 /**
132 * @param {boolean} isNtp Whether to use the NTP as the home page. 121 * @param {boolean} isNtp Whether to use the NTP as the home page.
133 * @param {string} homepage If not using NTP, use this URL. 122 * @param {string} homepage If not using NTP, use this URL.
134 * @return {string} The sub-label. 123 * @return {string} The sub-label.
135 * @private 124 * @private
136 */ 125 */
137 getShowHomeSubLabel_: function(isNtp, homepage) { 126 getShowHomeSubLabel_: function(isNtp, homepage) {
138 if (isNtp) 127 if (isNtp)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 <if expr="is_linux and not chromeos"> 210 <if expr="is_linux and not chromeos">
222 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; 211 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme';
223 </if> 212 </if>
224 <if expr="not is_linux or chromeos"> 213 <if expr="not is_linux or chromeos">
225 i18nId = 'chooseFromWebStore'; 214 i18nId = 'chooseFromWebStore';
226 </if> 215 </if>
227 this.themeSublabel_ = this.i18n(i18nId); 216 this.themeSublabel_ = this.i18n(i18nId);
228 this.themeUrl_ = ''; 217 this.themeUrl_ = '';
229 }, 218 },
230 219
231 /** 220 /** @private */
232 * @param {number} percent The integer percentage of the page zoom. 221 onZoomLevelChange_: function() {
233 * @private 222 chrome.settingsPrivate.setDefaultZoomPercent(
234 */ 223 parseFloat(this.$.zoomLevel.value));
235 zoomPrefChanged_: function(percent) {
236 this.set('defaultZoomLevel_.value', percent);
237 }, 224 },
238 225
239 /** 226 /**
240 * @param {number} percent The integer percentage of the page zoom.
241 * @private
242 */
243 zoomLevelChanged_: function(percent) {
244 // The |percent| may be undefined on startup.
245 if (percent === undefined)
246 return;
247 chrome.settingsPrivate.setDefaultZoomPercent(percent);
248 },
249
250 /**
251 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. 227 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible.
252 * @return {string} 'first' if the argument is false or empty otherwise. 228 * @return {string} 'first' if the argument is false or empty otherwise.
253 * @private 229 * @private
254 */ 230 */
255 getFirst_: function(bookmarksBarVisible) { 231 getFirst_: function(bookmarksBarVisible) {
256 return !bookmarksBarVisible ? 'first' : ''; 232 return !bookmarksBarVisible ? 'first' : '';
257 } 233 }
258 }); 234 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/appearance_page/appearance_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698