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 * @fileoverview | 6 * @fileoverview |
7 * 'settings-ui' implements the UI for the Settings page. | 7 * 'settings-ui' implements the UI for the Settings page. |
8 * | 8 * |
9 * Example: | 9 * Example: |
10 * | 10 * |
11 * <settings-ui prefs="{{prefs}}"></settings-ui> | 11 * <settings-ui prefs="{{prefs}}"></settings-ui> |
12 */ | 12 */ |
| 13 cr.exportPath('settings'); |
| 14 assert(!settings.defaultResourceLoaded, |
| 15 'settings_ui.js run twice. You probably have an invalid import.'); |
| 16 /** Global defined when the main Settings script runs. */ |
| 17 settings.defaultResourceLoaded = true; |
| 18 |
13 Polymer({ | 19 Polymer({ |
14 is: 'settings-ui', | 20 is: 'settings-ui', |
15 | 21 |
16 properties: { | 22 properties: { |
17 /** | 23 /** |
18 * Preferences state. | 24 * Preferences state. |
19 */ | 25 */ |
20 prefs: Object, | 26 prefs: Object, |
21 | 27 |
22 /** @type {?settings.DirectionDelegate} */ | 28 /** @type {?settings.DirectionDelegate} */ |
23 directionDelegate: { | 29 directionDelegate: { |
24 observer: 'directionDelegateChanged_', | 30 observer: 'directionDelegateChanged_', |
25 type: Object, | 31 type: Object, |
| 32 value: new settings.DirectionDelegateImpl(), |
26 }, | 33 }, |
27 | 34 |
28 /** @private {boolean} */ | 35 /** @private {boolean} */ |
29 toolbarSpinnerActive_: { | 36 toolbarSpinnerActive_: { |
30 type: Boolean, | 37 type: Boolean, |
31 value: false, | 38 value: false, |
32 }, | 39 }, |
33 | 40 |
34 /** | 41 /** |
35 * Dictionary defining page visibility. | 42 * Dictionary defining page visibility. |
36 * @private {!GuestModePageVisibility} | 43 * @private {!GuestModePageVisibility} |
37 */ | 44 */ |
38 pageVisibility_: Object, | 45 pageVisibility_: Object, |
39 }, | 46 }, |
40 | 47 |
| 48 /** @override */ |
| 49 created: function() { |
| 50 settings.initializeRouteFromUrl(); |
| 51 }, |
| 52 |
41 /** | 53 /** |
42 * @override | 54 * @override |
43 * @suppress {es5Strict} Object literals cannot contain duplicate keys in ES5 | 55 * @suppress {es5Strict} Object literals cannot contain duplicate keys in ES5 |
44 * strict mode. | 56 * strict mode. |
45 */ | 57 */ |
46 ready: function() { | 58 ready: function() { |
47 this.$$('cr-toolbar').addEventListener('search-changed', function(e) { | 59 this.$$('cr-toolbar').addEventListener('search-changed', function(e) { |
48 this.$$('settings-main').searchContents(e.detail); | 60 this.$$('settings-main').searchContents(e.detail); |
49 }.bind(this)); | 61 }.bind(this)); |
50 | 62 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 onMenuButtonTap_: function() { | 118 onMenuButtonTap_: function() { |
107 this.$$('app-drawer').toggle(); | 119 this.$$('app-drawer').toggle(); |
108 }, | 120 }, |
109 | 121 |
110 /** @private */ | 122 /** @private */ |
111 directionDelegateChanged_: function() { | 123 directionDelegateChanged_: function() { |
112 this.$$('app-drawer').align = this.directionDelegate.isRtl() ? | 124 this.$$('app-drawer').align = this.directionDelegate.isRtl() ? |
113 'right' : 'left'; | 125 'right' : 'left'; |
114 }, | 126 }, |
115 }); | 127 }); |
OLD | NEW |