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

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

Issue 2847963003: [MD settings] specify @override on created, ready, and attached (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/resources/settings/date_time_page/date_time_page.js » ('j') | 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 /** 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 }, 115 },
116 }, 116 },
117 117
118 /** @private {?settings.AppearanceBrowserProxy} */ 118 /** @private {?settings.AppearanceBrowserProxy} */
119 browserProxy_: null, 119 browserProxy_: null,
120 120
121 observers: [ 121 observers: [
122 'defaultFontSizeChanged_(prefs.webkit.webprefs.default_font_size.value)', 122 'defaultFontSizeChanged_(prefs.webkit.webprefs.default_font_size.value)',
123 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', 123 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)',
124 124
125 // <if expr="is_linux and not chromeos"> 125 // <if expr="is_linux and not chromeos">
126 // NOTE: this pref only exists on Linux. 126 // NOTE: this pref only exists on Linux.
127 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', 127 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)',
128 // </if> 128 // </if>
129 ], 129 ],
130 130
131 /** @override */
131 created: function() { 132 created: function() {
132 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); 133 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance();
133 }, 134 },
134 135
136 /** @override */
135 ready: function() { 137 ready: function() {
136 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 138 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
137 // TODO(dschuyler): Look into adding a listener for the 139 // TODO(dschuyler): Look into adding a listener for the
138 // default zoom percent. 140 // default zoom percent.
139 this.browserProxy_.getDefaultZoom().then(function(zoom) { 141 this.browserProxy_.getDefaultZoom().then(function(zoom) {
140 this.defaultZoom_ = zoom; 142 this.defaultZoom_ = zoom;
141 }.bind(this)); 143 }.bind(this));
142 }, 144 },
143 145
144 /** 146 /**
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 191
190 /** 192 /**
191 * URL for either current theme or the theme gallery. 193 * URL for either current theme or the theme gallery.
192 * @return {string} 194 * @return {string}
193 * @private 195 * @private
194 */ 196 */
195 getThemeHref_: function() { 197 getThemeHref_: function() {
196 return this.themeUrl_ || loadTimeData.getString('themesGalleryUrl'); 198 return this.themeUrl_ || loadTimeData.getString('themesGalleryUrl');
197 }, 199 },
198 200
199 // <if expr="chromeos"> 201 // <if expr="chromeos">
200 /** 202 /**
201 * ChromeOS only. 203 * ChromeOS only.
202 * @private 204 * @private
203 */ 205 */
204 openWallpaperManager_: function() { 206 openWallpaperManager_: function() {
205 this.browserProxy_.openWallpaperManager(); 207 this.browserProxy_.openWallpaperManager();
206 }, 208 },
207 // </if> 209 // </if>
208 210
209 /** @private */ 211 /** @private */
210 onUseDefaultTap_: function() { 212 onUseDefaultTap_: function() {
211 this.browserProxy_.useDefaultTheme(); 213 this.browserProxy_.useDefaultTheme();
212 }, 214 },
213 215
214 // <if expr="is_linux and not chromeos"> 216 // <if expr="is_linux and not chromeos">
215 /** 217 /**
216 * @param {boolean} useSystemTheme 218 * @param {boolean} useSystemTheme
217 * @private 219 * @private
218 */ 220 */
219 useSystemThemePrefChanged_: function(useSystemTheme) { 221 useSystemThemePrefChanged_: function(useSystemTheme) {
220 this.useSystemTheme_ = useSystemTheme; 222 this.useSystemTheme_ = useSystemTheme;
221 }, 223 },
222 224
223 /** 225 /**
224 * @param {string} themeId 226 * @param {string} themeId
(...skipping 24 matching lines...) Expand all
249 */ 251 */
250 showThemesSecondary_: function(themeId, useSystemTheme) { 252 showThemesSecondary_: function(themeId, useSystemTheme) {
251 return this.showUseClassic_(themeId, useSystemTheme) || 253 return this.showUseClassic_(themeId, useSystemTheme) ||
252 this.showUseSystem_(themeId, useSystemTheme); 254 this.showUseSystem_(themeId, useSystemTheme);
253 }, 255 },
254 256
255 /** @private */ 257 /** @private */
256 onUseSystemTap_: function() { 258 onUseSystemTap_: function() {
257 this.browserProxy_.useSystemTheme(); 259 this.browserProxy_.useSystemTheme();
258 }, 260 },
259 // </if> 261 // </if>
260 262
261 /** 263 /**
262 * @param {string} themeId 264 * @param {string} themeId
263 * @param {boolean} useSystemTheme 265 * @param {boolean} useSystemTheme
264 * @private 266 * @private
265 */ 267 */
266 themeChanged_: function(themeId, useSystemTheme) { 268 themeChanged_: function(themeId, useSystemTheme) {
267 if (themeId) { 269 if (themeId) {
268 assert(!useSystemTheme); 270 assert(!useSystemTheme);
269 271
270 this.browserProxy_.getThemeInfo(themeId).then(function(info) { 272 this.browserProxy_.getThemeInfo(themeId).then(function(info) {
271 this.themeSublabel_ = info.name; 273 this.themeSublabel_ = info.name;
272 }.bind(this)); 274 }.bind(this));
273 275
274 this.themeUrl_ = 'https://chrome.google.com/webstore/detail/' + themeId; 276 this.themeUrl_ = 'https://chrome.google.com/webstore/detail/' + themeId;
275 return; 277 return;
276 } 278 }
277 279
278 var i18nId; 280 var i18nId;
279 // <if expr="is_linux and not chromeos"> 281 // <if expr="is_linux and not chromeos">
280 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; 282 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme';
281 // </if> 283 // </if>
282 // <if expr="not is_linux or chromeos"> 284 // <if expr="not is_linux or chromeos">
283 i18nId = 'chooseFromWebStore'; 285 i18nId = 'chooseFromWebStore';
284 // </if> 286 // </if>
285 this.themeSublabel_ = this.i18n(i18nId); 287 this.themeSublabel_ = this.i18n(i18nId);
286 this.themeUrl_ = ''; 288 this.themeUrl_ = '';
287 }, 289 },
288 290
289 /** @private */ 291 /** @private */
290 onZoomLevelChange_: function() { 292 onZoomLevelChange_: function() {
291 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); 293 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value));
292 }, 294 },
293 295
294 /** 296 /**
295 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. 297 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible.
296 * @return {string} 'first' if the argument is false or empty otherwise. 298 * @return {string} 'first' if the argument is false or empty otherwise.
297 * @private 299 * @private
298 */ 300 */
299 getFirst_: function(bookmarksBarVisible) { 301 getFirst_: function(bookmarksBarVisible) {
300 return !bookmarksBarVisible ? 'first' : ''; 302 return !bookmarksBarVisible ? 'first' : '';
301 }, 303 },
302 304
303 /** 305 /**
304 * @see content::ZoomValuesEqual(). 306 * @see content::ZoomValuesEqual().
305 * @param {number} zoom1 307 * @param {number} zoom1
306 * @param {number} zoom2 308 * @param {number} zoom2
307 * @return {boolean} 309 * @return {boolean}
308 * @private 310 * @private
309 */ 311 */
310 zoomValuesEqual_: function(zoom1, zoom2) { 312 zoomValuesEqual_: function(zoom1, zoom2) {
311 return Math.abs(zoom1 - zoom2) <= 0.001; 313 return Math.abs(zoom1 - zoom2) <= 0.001;
312 }, 314 },
313 }); 315 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/settings/date_time_page/date_time_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698