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

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

Issue 1635673003: MD Settings: Add helper method for responding to cr.sendWithPromise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments. Created 4 years, 10 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/ui/webui/settings/appearance_handler.cc » ('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 * '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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 this.$.pageZoom.menuOptions = this.pageZoomOptions_; 117 this.$.pageZoom.menuOptions = this.pageZoomOptions_;
118 // TODO(dschuyler): Look into adding a listener for the 118 // TODO(dschuyler): Look into adding a listener for the
119 // default zoom percent. 119 // default zoom percent.
120 chrome.settingsPrivate.getDefaultZoomPercent( 120 chrome.settingsPrivate.getDefaultZoomPercent(
121 this.zoomPrefChanged_.bind(this)); 121 this.zoomPrefChanged_.bind(this));
122 }, 122 },
123 123
124 /** @override */ 124 /** @override */
125 attached: function() { 125 attached: function() {
126 // Query the initial state. 126 // Query the initial state.
127 cr.sendWithPromise('getResetThemeEnabled').then(function(response) { 127 cr.sendWithPromise('getResetThemeEnabled').then(
128 this.setResetThemeEnabled(response[0]); 128 this.setResetThemeEnabled.bind(this));
129 }.bind(this));
130 129
131 // Set up the change event listener. 130 // Set up the change event listener.
132 cr.addWebUIListener('reset-theme-enabled-changed', 131 cr.addWebUIListener('reset-theme-enabled-changed',
133 this.setResetThemeEnabled.bind(this)); 132 this.setResetThemeEnabled.bind(this));
134 }, 133 },
135 134
136 /** 135 /**
137 * @param {boolean} enabled Whether the theme reset is available. 136 * @param {boolean} enabled Whether the theme reset is available.
138 */ 137 */
139 setResetThemeEnabled: function(enabled) { 138 setResetThemeEnabled: function(enabled) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 * @param {number} percent The integer percentage of the page zoom. 171 * @param {number} percent The integer percentage of the page zoom.
173 * @private 172 * @private
174 */ 173 */
175 zoomLevelChanged_: function(percent) { 174 zoomLevelChanged_: function(percent) {
176 // The |percent| may be undefined on startup. 175 // The |percent| may be undefined on startup.
177 if (percent === undefined) 176 if (percent === undefined)
178 return; 177 return;
179 chrome.settingsPrivate.setDefaultZoomPercent(percent); 178 chrome.settingsPrivate.setDefaultZoomPercent(percent);
180 }, 179 },
181 }); 180 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/settings/appearance_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698