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