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

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

Issue 2811693004: MD Settings: Restore focus after exiting various subpages. (Closed)
Patch Set: More Created 3 years, 8 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 }, 82 },
83 83
84 /** @private */ 84 /** @private */
85 themeSublabel_: String, 85 themeSublabel_: String,
86 86
87 /** @private */ 87 /** @private */
88 useSystemTheme_: { 88 useSystemTheme_: {
89 type: Boolean, 89 type: Boolean,
90 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.
91 }, 91 },
92
93 /** @private {?Map<string, string>} */
94 focusConfig_: Object,
92 }, 95 },
93 96
94 /** @private {?settings.AppearanceBrowserProxy} */ 97 /** @private {?settings.AppearanceBrowserProxy} */
95 browserProxy_: null, 98 browserProxy_: null,
96 99
97 /** @private {string} */ 100 /** @private {string} */
98 themeUrl_: '', 101 themeUrl_: '',
99 102
100 observers: [ 103 observers: [
101 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', 104 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)',
102 105
103 // <if expr="is_linux and not chromeos"> 106 // <if expr="is_linux and not chromeos">
104 // NOTE: this pref only exists on Linux. 107 // NOTE: this pref only exists on Linux.
105 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', 108 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)',
106 // </if> 109 // </if>
107 ], 110 ],
108 111
109 created: function() { 112 created: function() {
110 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); 113 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance();
111 }, 114 },
112 115
113 ready: function() { 116 ready: function() {
114 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 117 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
115 // TODO(dschuyler): Look into adding a listener for the 118 // TODO(dschuyler): Look into adding a listener for the
116 // default zoom percent. 119 // default zoom percent.
117 this.browserProxy_.getDefaultZoom().then(function(zoom) { 120 this.browserProxy_.getDefaultZoom().then(function(zoom) {
118 this.defaultZoom_ = zoom; 121 this.defaultZoom_ = zoom;
119 }.bind(this)); 122 }.bind(this));
123
124 this.focusConfig_ = new Map();
125 this.focusConfig_.set(
126 settings.Route.FONTS.path,
127 '#customize-fonts-subpage-trigger .subpage-arrow');
120 }, 128 },
121 129
122 /** 130 /**
123 * @param {number} zoom 131 * @param {number} zoom
124 * @return {number} A zoom easier read by users. 132 * @return {number} A zoom easier read by users.
125 * @private 133 * @private
126 */ 134 */
127 formatZoom_: function(zoom) { 135 formatZoom_: function(zoom) {
128 return Math.round(zoom * 100); 136 return Math.round(zoom * 100);
129 }, 137 },
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 * @see content::ZoomValuesEqual(). 274 * @see content::ZoomValuesEqual().
267 * @param {number} zoom1 275 * @param {number} zoom1
268 * @param {number} zoom2 276 * @param {number} zoom2
269 * @return {boolean} 277 * @return {boolean}
270 * @private 278 * @private
271 */ 279 */
272 zoomValuesEqual_: function(zoom1, zoom2) { 280 zoomValuesEqual_: function(zoom1, zoom2) {
273 return Math.abs(zoom1 - zoom2) <= 0.001; 281 return Math.abs(zoom1 - zoom2) <= 0.001;
274 }, 282 },
275 }); 283 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698