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