| 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 | |
| 6 | |
| 7 /** | 5 /** |
| 8 * 'cr-settings-appearance-page' is the settings page containing appearance | 6 * 'cr-settings-appearance-page' is the settings page containing appearance |
| 9 * settings. | 7 * settings. |
| 10 * | 8 * |
| 11 * Example: | 9 * Example: |
| 12 * | 10 * |
| 13 * <iron-animated-pages> | 11 * <iron-animated-pages> |
| 14 * <cr-settings-appearance-page prefs="{{prefs}}"> | 12 * <cr-settings-appearance-page prefs="{{prefs}}"> |
| 15 * </cr-settings-appearance-page> | 13 * </cr-settings-appearance-page> |
| 16 * ... other pages ... | 14 * ... other pages ... |
| 17 * </iron-animated-pages> | 15 * </iron-animated-pages> |
| 18 * | 16 * |
| 19 * @group Chrome Settings Elements | 17 * @group Chrome Settings Elements |
| 20 * @element cr-settings-appearance-page | 18 * @element cr-settings-appearance-page |
| 21 */ | 19 */ |
| 22 Polymer({ | 20 Polymer({ |
| 23 is: 'cr-settings-appearance-page', | 21 is: 'cr-settings-appearance-page', |
| 24 | 22 |
| 25 /** @override */ | |
| 26 attached: function() { | |
| 27 // Query the initial state. | |
| 28 cr.sendWithCallback('getResetThemeEnabled', undefined, | |
| 29 this.setResetThemeEnabled.bind(this)); | |
| 30 | |
| 31 // Set up the change event listener. | |
| 32 cr.addWebUIListener('reset-theme-enabled-changed', | |
| 33 this.setResetThemeEnabled.bind(this)); | |
| 34 }, | |
| 35 | |
| 36 properties: { | 23 properties: { |
| 37 /** | 24 /** |
| 38 * Preferences state. | 25 * Preferences state. |
| 39 */ | 26 */ |
| 40 prefs: { | 27 prefs: { |
| 41 type: Object, | 28 type: Object, |
| 42 notify: true, | 29 notify: true, |
| 43 }, | 30 }, |
| 44 | 31 |
| 45 /** | 32 /** |
| 46 * Translated strings used in data binding. | 33 * Translated strings used in data binding. |
| 47 */ | 34 */ |
| 48 i18n_: { | 35 i18n_: { |
| 49 type: Object, | 36 type: Object, |
| 50 value: function() { | 37 value: function() { |
| 51 return { | 38 return { |
| 52 homePageNtp: loadTimeData.getString('homePageNtp'), | 39 homePageNtp: loadTimeData.getString('homePageNtp'), |
| 53 openThisPage: loadTimeData.getString('openThisPage'), | 40 openThisPage: loadTimeData.getString('openThisPage'), |
| 54 }; | 41 }; |
| 55 }, | 42 }, |
| 56 }, | 43 }, |
| 57 }, | 44 }, |
| 58 | 45 |
| 46 /** @override */ |
| 47 attached: function() { |
| 48 // Query the initial state. |
| 49 cr.sendWithCallback('getResetThemeEnabled', undefined, |
| 50 this.setResetThemeEnabled.bind(this)); |
| 51 |
| 52 // Set up the change event listener. |
| 53 cr.addWebUIListener('reset-theme-enabled-changed', |
| 54 this.setResetThemeEnabled.bind(this)); |
| 55 }, |
| 56 |
| 59 setResetThemeEnabled: function(enabled) { | 57 setResetThemeEnabled: function(enabled) { |
| 60 this.$.resetTheme.disabled = !enabled; | 58 this.$.resetTheme.disabled = !enabled; |
| 61 }, | 59 }, |
| 62 | 60 |
| 63 /** @private */ | 61 /** @private */ |
| 64 openThemesGallery_: function() { | 62 openThemesGallery_: function() { |
| 65 window.open(loadTimeData.getString('themesGalleryUrl')); | 63 window.open(loadTimeData.getString('themesGalleryUrl')); |
| 66 }, | 64 }, |
| 67 | 65 |
| 68 /** @private */ | 66 /** @private */ |
| 69 resetTheme_: function() { | 67 resetTheme_: function() { |
| 70 chrome.send('resetTheme'); | 68 chrome.send('resetTheme'); |
| 71 }, | 69 }, |
| 72 }); | 70 }); |
| OLD | NEW |