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

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

Issue 1896283003: [MD settings] appearance theme and wallpaper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: param comments Created 4 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 10 matching lines...) Expand all
21 21
22 properties: { 22 properties: {
23 /** 23 /**
24 * The current active route. 24 * The current active route.
25 */ 25 */
26 currentRoute: { 26 currentRoute: {
27 notify: true, 27 notify: true,
28 type: Object, 28 type: Object,
29 }, 29 },
30 30
31 /** @private {!settings.AppearanceBrowserProxy} */
32 browserProxy_: Object,
33
31 /** 34 /**
32 * Preferences state. 35 * Preferences state.
33 */ 36 */
34 prefs: { 37 prefs: {
35 type: Object, 38 type: Object,
36 notify: true, 39 notify: true,
37 }, 40 },
38 41
39 /** 42 /**
40 * @private 43 * @private
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 107
105 /** @private */ 108 /** @private */
106 themeSublabel_: String, 109 themeSublabel_: String,
107 }, 110 },
108 111
109 observers: [ 112 observers: [
110 'themeChanged_(prefs.extensions.theme.id.value)', 113 'themeChanged_(prefs.extensions.theme.id.value)',
111 'zoomLevelChanged_(defaultZoomLevel_.value)', 114 'zoomLevelChanged_(defaultZoomLevel_.value)',
112 ], 115 ],
113 116
117 created: function() {
118 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance();
119 },
120
114 ready: function() { 121 ready: function() {
115 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 122 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
116 this.$.pageZoom.menuOptions = this.pageZoomOptions_; 123 this.$.pageZoom.menuOptions = this.pageZoomOptions_;
117 // TODO(dschuyler): Look into adding a listener for the 124 // TODO(dschuyler): Look into adding a listener for the
118 // default zoom percent. 125 // default zoom percent.
119 chrome.settingsPrivate.getDefaultZoomPercent( 126 chrome.settingsPrivate.getDefaultZoomPercent(
120 this.zoomPrefChanged_.bind(this)); 127 this.zoomPrefChanged_.bind(this));
121 }, 128 },
122 129
123 /** @override */ 130 /** @override */
124 attached: function() { 131 attached: function() {
125 // Query the initial state. 132 // Query the initial state.
126 cr.sendWithPromise('getResetThemeEnabled').then( 133 this.browserProxy_.getResetThemeEnabled().then(
127 this.setResetThemeEnabled.bind(this)); 134 this.setResetThemeEnabled.bind(this));
128 135
129 // Set up the change event listener. 136 // Set up the change event listener.
130 cr.addWebUIListener('reset-theme-enabled-changed', 137 cr.addWebUIListener('reset-theme-enabled-changed',
131 this.setResetThemeEnabled.bind(this)); 138 this.setResetThemeEnabled.bind(this));
132 }, 139 },
133 140
134 /** 141 /**
135 * @param {boolean} isNtp Whether to use the NTP as the home page. 142 * @param {boolean} isNtp Whether to use the NTP as the home page.
136 * @param {string} homepage If not using NTP, use this URL. 143 * @param {string} homepage If not using NTP, use this URL.
(...skipping 16 matching lines...) Expand all
153 /** @private */ 160 /** @private */
154 onCustomizeFontsTap_: function() { 161 onCustomizeFontsTap_: function() {
155 this.$.pages.setSubpageChain(['appearance-fonts']); 162 this.$.pages.setSubpageChain(['appearance-fonts']);
156 }, 163 },
157 164
158 /** @private */ 165 /** @private */
159 openThemesGallery_: function() { 166 openThemesGallery_: function() {
160 window.open(loadTimeData.getString('themesGalleryUrl')); 167 window.open(loadTimeData.getString('themesGalleryUrl'));
161 }, 168 },
162 169
170 /**
dpapad 2016/04/19 23:32:40 Same here, let's wrap with "if expr". I think you
dschuyler 2016/04/20 00:19:07 Done.
171 * ChromeOS only.
172 * @private
173 */
174 openWallpaperGallery_: function() {
dpapad 2016/04/19 23:32:40 Nit(optional): Gallery vs Manager, can we stick wi
dschuyler 2016/04/20 00:19:06 Done.
175 this.browserProxy_.openWallpaperManager();
176 },
177
163 /** @private */ 178 /** @private */
164 resetTheme_: function() { 179 resetTheme_: function() {
165 chrome.send('resetTheme'); 180 this.browserProxy_.resetTheme();
166 }, 181 },
167 182
168 /** @private */ 183 /** @private */
169 showFontsPage_: function() { 184 showFontsPage_: function() {
170 return this.currentRoute.subpage[0] == 'appearance-fonts'; 185 return this.currentRoute.subpage[0] == 'appearance-fonts';
171 }, 186 },
172 187
173 /** 188 /**
174 * @param {string} themeId The theme ID. 189 * @param {string} themeId The theme ID.
175 * @private 190 * @private
(...skipping 21 matching lines...) Expand all
197 * @param {number} percent The integer percentage of the page zoom. 212 * @param {number} percent The integer percentage of the page zoom.
198 * @private 213 * @private
199 */ 214 */
200 zoomLevelChanged_: function(percent) { 215 zoomLevelChanged_: function(percent) {
201 // The |percent| may be undefined on startup. 216 // The |percent| may be undefined on startup.
202 if (percent === undefined) 217 if (percent === undefined)
203 return; 218 return;
204 chrome.settingsPrivate.setDefaultZoomPercent(percent); 219 chrome.settingsPrivate.setDefaultZoomPercent(percent);
205 }, 220 },
206 }); 221 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698