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

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

Issue 1622663002: WebUI: Replace cr.sendWithCallback with cr.sendWithPromise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Migrating caller + cleanups. Created 4 years, 11 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/chrome_tests.gypi » ('j') | chrome/test/data/webui/cr_test.html » ('J')
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.sendWithCallback('getResetThemeEnabled', undefined, 127 cr.sendWithPromise('getResetThemeEnabled').then(
128 this.setResetThemeEnabled.bind(this)); 128 function(response) {
129 this.setResetThemeEnabled(response[0]);
130 }.bind(this));
129 131
130 // Set up the change event listener. 132 // Set up the change event listener.
131 cr.addWebUIListener('reset-theme-enabled-changed', 133 cr.addWebUIListener('reset-theme-enabled-changed',
132 this.setResetThemeEnabled.bind(this)); 134 this.setResetThemeEnabled.bind(this));
133 }, 135 },
134 136
135 /** 137 /**
136 * @param {boolean} enabled Whether the theme reset is available. 138 * @param {boolean} enabled Whether the theme reset is available.
137 */ 139 */
138 setResetThemeEnabled: function(enabled) { 140 setResetThemeEnabled: function(enabled) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 * @param {number} percent The integer percentage of the page zoom. 173 * @param {number} percent The integer percentage of the page zoom.
172 * @private 174 * @private
173 */ 175 */
174 zoomLevelChanged_: function(percent) { 176 zoomLevelChanged_: function(percent) {
175 // The |percent| may be undefined on startup. 177 // The |percent| may be undefined on startup.
176 if (percent === undefined) 178 if (percent === undefined)
177 return; 179 return;
178 chrome.settingsPrivate.setDefaultZoomPercent(percent); 180 chrome.settingsPrivate.setDefaultZoomPercent(percent);
179 }, 181 },
180 }); 182 });
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | chrome/test/data/webui/cr_test.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698