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

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

Issue 2487423002: MD Settings: add tests for mischievous default zoom handling (Closed)
Patch Set: closure 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
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 13 matching lines...) Expand all
24 * Dictionary defining page visibility. 24 * Dictionary defining page visibility.
25 * @type {!AppearancePageVisibility} 25 * @type {!AppearancePageVisibility}
26 */ 26 */
27 pageVisibility: Object, 27 pageVisibility: Object,
28 28
29 prefs: { 29 prefs: {
30 type: Object, 30 type: Object,
31 notify: true, 31 notify: true,
32 }, 32 },
33 33
34 /** @private {!settings.AppearanceBrowserProxy} */
35 browserProxy_: Object,
36
37 /** @private */ 34 /** @private */
38 defaultZoom_: Number, 35 defaultZoom_: Number,
39 36
40 /** 37 /**
41 * List of options for the font size drop-down menu. 38 * List of options for the font size drop-down menu.
42 * @type {!DropdownMenuOptionList} 39 * @type {!DropdownMenuOptionList}
43 */ 40 */
44 fontSizeOptions_: { 41 fontSizeOptions_: {
45 readOnly: true, 42 readOnly: true,
46 type: Array, 43 type: Array,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 /** @private */ 84 /** @private */
88 themeSublabel_: String, 85 themeSublabel_: String,
89 86
90 /** @private */ 87 /** @private */
91 useSystemTheme_: { 88 useSystemTheme_: {
92 type: Boolean, 89 type: Boolean,
93 value: false, // Can only be true on Linux, but value exists everywhere. 90 value: false, // Can only be true on Linux, but value exists everywhere.
94 }, 91 },
95 }, 92 },
96 93
94 /** @private {?settings.AppearanceBrowserProxy} */
95 browserProxy_: null,
96
97 /** @private {string} */ 97 /** @private {string} */
98 themeUrl_: '', 98 themeUrl_: '',
99 99
100 observers: [ 100 observers: [
101 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', 101 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)',
102 102
103 <if expr="is_linux and not chromeos"> 103 <if expr="is_linux and not chromeos">
104 // NOTE: this pref only exists on Linux. 104 // NOTE: this pref only exists on Linux.
105 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', 105 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)',
106 </if> 106 </if>
107 ], 107 ],
108 108
109 created: function() { 109 created: function() {
110 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); 110 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance();
111 }, 111 },
112 112
113 ready: function() { 113 ready: function() {
114 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 114 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
115 // TODO(dschuyler): Look into adding a listener for the 115 // TODO(dschuyler): Look into adding a listener for the
116 // default zoom percent. 116 // default zoom percent.
117 chrome.settingsPrivate.getDefaultZoom(function(zoom) { 117 this.browserProxy_.getDefaultZoom().then(function(zoom) {
118 this.defaultZoom_ = zoom; 118 this.defaultZoom_ = zoom;
119 }.bind(this)); 119 }.bind(this));
120 }, 120 },
121 121
122 /** 122 /**
123 * @param {number} zoom 123 * @param {number} zoom
124 * @return {number} A zoom easier read by users. 124 * @return {number} A zoom easier read by users.
125 * @private 125 * @private
126 */ 126 */
127 formatZoom_: function(zoom) { 127 formatZoom_: function(zoom) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 * @see content::ZoomValuesEqual(). 258 * @see content::ZoomValuesEqual().
259 * @param {number} zoom1 259 * @param {number} zoom1
260 * @param {number} zoom2 260 * @param {number} zoom2
261 * @return {boolean} 261 * @return {boolean}
262 * @private 262 * @private
263 */ 263 */
264 zoomValuesEqual_: function(zoom1, zoom2) { 264 zoomValuesEqual_: function(zoom1, zoom2) {
265 return Math.abs(zoom1 - zoom2) <= 0.001; 265 return Math.abs(zoom1 - zoom2) <= 0.001;
266 }, 266 },
267 }); 267 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698