| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 }); |
| OLD | NEW |