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

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: Fix compilation. 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 this.$.zoomLevel.value = value;
Dan Beam 2016/10/14 22:58:27 this is all bonkers af
dpapad 2016/10/14 23:08:48 Added a note with link to related bug.
115 }.bind(this));
129 }, 116 },
130 117
131 /** 118 /**
132 * @param {boolean} isNtp Whether to use the NTP as the home page. 119 * @param {boolean} isNtp Whether to use the NTP as the home page.
133 * @param {string} homepage If not using NTP, use this URL. 120 * @param {string} homepage If not using NTP, use this URL.
134 * @return {string} The sub-label. 121 * @return {string} The sub-label.
135 * @private 122 * @private
136 */ 123 */
137 getShowHomeSubLabel_: function(isNtp, homepage) { 124 getShowHomeSubLabel_: function(isNtp, homepage) {
138 if (isNtp) 125 if (isNtp)
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 <if expr="is_linux and not chromeos"> 208 <if expr="is_linux and not chromeos">
222 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; 209 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme';
223 </if> 210 </if>
224 <if expr="not is_linux or chromeos"> 211 <if expr="not is_linux or chromeos">
225 i18nId = 'chooseFromWebStore'; 212 i18nId = 'chooseFromWebStore';
226 </if> 213 </if>
227 this.themeSublabel_ = this.i18n(i18nId); 214 this.themeSublabel_ = this.i18n(i18nId);
228 this.themeUrl_ = ''; 215 this.themeUrl_ = '';
229 }, 216 },
230 217
231 /** 218 /** @private */
232 * @param {number} percent The integer percentage of the page zoom. 219 onZoomLevelChange_: function() {
233 * @private 220 chrome.settingsPrivate.setDefaultZoomPercent(
234 */ 221 parseFloat(this.$.zoomLevel.value));
235 zoomPrefChanged_: function(percent) {
236 this.set('defaultZoomLevel_.value', percent);
237 }, 222 },
238 223
239 /** 224 /**
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. 225 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible.
252 * @return {string} 'first' if the argument is false or empty otherwise. 226 * @return {string} 'first' if the argument is false or empty otherwise.
253 * @private 227 * @private
254 */ 228 */
255 getFirst_: function(bookmarksBarVisible) { 229 getFirst_: function(bookmarksBarVisible) {
256 return !bookmarksBarVisible ? 'first' : ''; 230 return !bookmarksBarVisible ? 'first' : '';
257 } 231 }
258 }); 232 });
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