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

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

Issue 1841973004: [MD settings] theme name shown in sub-label, wallpaper chrome os only (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 *
11 * <iron-animated-pages> 11 * <iron-animated-pages>
12 * <settings-appearance-page prefs="{{prefs}}"> 12 * <settings-appearance-page prefs="{{prefs}}">
13 * </settings-appearance-page> 13 * </settings-appearance-page>
14 * ... other pages ... 14 * ... other pages ...
15 * </iron-animated-pages> 15 * </iron-animated-pages>
16 */ 16 */
17 Polymer({ 17 Polymer({
18 is: 'settings-appearance-page', 18 is: 'settings-appearance-page',
19 19
20 behaviors: [I18nBehavior],
21
20 properties: { 22 properties: {
21 /** 23 /**
22 * The current active route. 24 * The current active route.
23 */ 25 */
24 currentRoute: { 26 currentRoute: {
25 notify: true, 27 notify: true,
26 type: Object, 28 type: Object,
27 }, 29 },
28 30
29 /** 31 /**
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 {value: 110, name: '110%'}, 94 {value: 110, name: '110%'},
93 {value: 125, name: '125%'}, 95 {value: 125, name: '125%'},
94 {value: 150, name: '150%'}, 96 {value: 150, name: '150%'},
95 {value: 175, name: '175%'}, 97 {value: 175, name: '175%'},
96 {value: 200, name: '200%'}, 98 {value: 200, name: '200%'},
97 {value: 300, name: '300%'}, 99 {value: 300, name: '300%'},
98 {value: 400, name: '400%'}, 100 {value: 400, name: '400%'},
99 {value: 500, name: '500%'}, 101 {value: 500, name: '500%'},
100 ], 102 ],
101 }, 103 },
104
105 /** @private */
106 themeSublabel_: {
107 type: String,
108 value: function() { return this.i18n('chooseFromWebStore'); },
michaelpg 2016/03/31 15:48:21 does this duplicate what happens in themeChanged_,
dschuyler 2016/03/31 19:13:36 Done.
109 },
102 }, 110 },
103 111
104 behaviors: [
105 I18nBehavior,
106 ],
107
108 observers: [ 112 observers: [
113 'themeChanged_(prefs.extensions.theme.id.value)',
109 'zoomLevelChanged_(defaultZoomLevel_.value)', 114 'zoomLevelChanged_(defaultZoomLevel_.value)',
110 ], 115 ],
111 116
112 ready: function() { 117 ready: function() {
113 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; 118 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
114 this.$.pageZoom.menuOptions = this.pageZoomOptions_; 119 this.$.pageZoom.menuOptions = this.pageZoomOptions_;
115 // TODO(dschuyler): Look into adding a listener for the 120 // TODO(dschuyler): Look into adding a listener for the
116 // default zoom percent. 121 // default zoom percent.
117 chrome.settingsPrivate.getDefaultZoomPercent( 122 chrome.settingsPrivate.getDefaultZoomPercent(
118 this.zoomPrefChanged_.bind(this)); 123 this.zoomPrefChanged_.bind(this));
(...skipping 15 matching lines...) Expand all
134 * @param {string} homepage If not using NTP, use this URL. 139 * @param {string} homepage If not using NTP, use this URL.
135 * @return {string} The sub-label. 140 * @return {string} The sub-label.
136 * @private 141 * @private
137 */ 142 */
138 getShowHomeSubLabel_: function(isNtp, homepage) { 143 getShowHomeSubLabel_: function(isNtp, homepage) {
139 if (isNtp) 144 if (isNtp)
140 return this.i18n('homePageNtp'); 145 return this.i18n('homePageNtp');
141 return homepage || this.i18n('exampleDotCom'); 146 return homepage || this.i18n('exampleDotCom');
142 }, 147 },
143 148
144 /**
145 * @param {boolean} enabled Whether the theme reset is available.
146 */
147 setResetThemeEnabled: function(enabled) {
148 this.allowResetTheme_ = enabled;
149 },
150
151 /** @private */ 149 /** @private */
152 onCustomizeFontsTap_: function() { 150 onCustomizeFontsTap_: function() {
153 this.$.pages.setSubpageChain(['appearance-fonts']); 151 this.$.pages.setSubpageChain(['appearance-fonts']);
154 }, 152 },
155 153
156 /** @private */ 154 /** @private */
157 openThemesGallery_: function() { 155 openThemesGallery_: function() {
158 window.open(loadTimeData.getString('themesGalleryUrl')); 156 window.open(loadTimeData.getString('themesGalleryUrl'));
159 }, 157 },
160 158
159 /**
160 * ChromeOS only.
161 * @private
162 * */
michaelpg 2016/03/31 15:48:21 nit: extra ' *'
dschuyler 2016/03/31 19:13:36 Done.
163 openWallpaperGallery_: function() {
164 chrome.send('openWallpaperManager');
michaelpg 2016/03/31 15:48:21 does this exist in a settings handler?
michaelpg 2016/03/31 15:48:21 Dan just said to always use a browser proxy instea
Dan Beam 2016/03/31 17:53:21 i didn't necesarilly say "always", but I do agree
dschuyler 2016/03/31 19:13:36 Acknowledged.
dschuyler 2016/03/31 19:13:36 Done.
dschuyler 2016/03/31 19:13:36 I'm on board with the conversion. I'm just doing
165 },
166
161 /** @private */ 167 /** @private */
162 resetTheme_: function() { 168 resetTheme_: function() {
163 chrome.send('resetTheme'); 169 chrome.send('resetTheme');
164 }, 170 },
165 171
172 /**
173 * @param {boolean} enabled Whether the theme reset is available.
174 */
175 setResetThemeEnabled: function(enabled) {
michaelpg 2016/03/31 15:48:21 I assume you have a reason for moving this from on
dschuyler 2016/03/31 19:13:36 Done.
176 this.allowResetTheme_ = enabled;
177 },
178
166 /** @private */ 179 /** @private */
167 showFontsPage_: function() { 180 showFontsPage_: function() {
168 return this.currentRoute.subpage[0] == 'appearance-fonts'; 181 return this.currentRoute.subpage[0] == 'appearance-fonts';
169 }, 182 },
170 183
171 /** 184 /**
185 * @param {string} themeId The theme ID.
186 * @private
187 */
188 themeChanged_: function(themeId) {
189 if (themeId) {
190 var self = this;
michaelpg 2016/03/31 15:48:21 nit: .bind(this) instead, as that's more common?
dschuyler 2016/03/31 19:13:36 Done.
191 chrome.management.get(themeId,
192 function(info) {
193 self.themeSublabel_ = info.name;
michaelpg 2016/03/31 15:48:21 2-space indent
dschuyler 2016/03/31 19:13:36 Done.
194 });
195 } else {
196 this.themeSublabel_ = this.i18n('chooseFromWebStore');
197 }
198 },
199
200 /**
172 * @param {number} percent The integer percentage of the page zoom. 201 * @param {number} percent The integer percentage of the page zoom.
173 * @private 202 * @private
174 */ 203 */
175 zoomPrefChanged_: function(percent) { 204 zoomPrefChanged_: function(percent) {
176 this.set('defaultZoomLevel_.value', percent); 205 this.set('defaultZoomLevel_.value', percent);
177 }, 206 },
178 207
179 /** 208 /**
180 * @param {number} percent The integer percentage of the page zoom. 209 * @param {number} percent The integer percentage of the page zoom.
181 * @private 210 * @private
182 */ 211 */
183 zoomLevelChanged_: function(percent) { 212 zoomLevelChanged_: function(percent) {
184 // The |percent| may be undefined on startup. 213 // The |percent| may be undefined on startup.
185 if (percent === undefined) 214 if (percent === undefined)
186 return; 215 return;
187 chrome.settingsPrivate.setDefaultZoomPercent(percent); 216 chrome.settingsPrivate.setDefaultZoomPercent(percent);
188 }, 217 },
189 }); 218 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698