| 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'); | 13 cr.exportPath('settings'); |
| 14 assert(!settings.defaultResourceLoaded, | 14 assert(!settings.defaultResourceLoaded, |
| 15 'settings_ui.js run twice. You probably have an invalid import.'); | 15 'settings_ui.js run twice. You probably have an invalid import.'); |
| 16 /** Global defined when the main Settings script runs. */ | 16 /** Global defined when the main Settings script runs. */ |
| 17 settings.defaultResourceLoaded = true; | 17 settings.defaultResourceLoaded = true; |
| 18 | 18 |
| 19 Polymer({ | 19 Polymer({ |
| 20 is: 'settings-ui', | 20 is: 'settings-ui', |
| 21 | 21 |
| 22 behaviors: [GlobalScrollTargetBehavior], |
| 23 |
| 22 properties: { | 24 properties: { |
| 23 /** | 25 /** |
| 24 * Preferences state. | 26 * Preferences state. |
| 25 */ | 27 */ |
| 26 prefs: Object, | 28 prefs: Object, |
| 27 | 29 |
| 28 /** @type {?settings.DirectionDelegate} */ | 30 /** @type {?settings.DirectionDelegate} */ |
| 29 directionDelegate: { | 31 directionDelegate: { |
| 30 observer: 'directionDelegateChanged_', | 32 observer: 'directionDelegateChanged_', |
| 31 type: Object, | 33 type: Object, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 }, | 108 }, |
| 107 </if> | 109 </if> |
| 108 }; | 110 }; |
| 109 } | 111 } |
| 110 }, | 112 }, |
| 111 | 113 |
| 112 /** @override */ | 114 /** @override */ |
| 113 attached: function() { | 115 attached: function() { |
| 114 // Preload bold Roboto so it doesn't load and flicker the first time used. | 116 // Preload bold Roboto so it doesn't load and flicker the first time used. |
| 115 document.fonts.load('bold 12px Roboto'); | 117 document.fonts.load('bold 12px Roboto'); |
| 118 this.setGlobalScrollTarget(this.$.headerPanel.scroller); |
| 116 }, | 119 }, |
| 117 | 120 |
| 118 /** | 121 /** |
| 119 * @param {Event} event | 122 * @param {Event} event |
| 120 * @private | 123 * @private |
| 121 */ | 124 */ |
| 122 onIronActivate_: function(event) { | 125 onIronActivate_: function(event) { |
| 123 if (event.detail.item.id != 'advancedPage') | 126 if (event.detail.item.id != 'advancedPage') |
| 124 this.$$('app-drawer').close(); | 127 this.$$('app-drawer').close(); |
| 125 }, | 128 }, |
| 126 | 129 |
| 127 /** @private */ | 130 /** @private */ |
| 128 onMenuButtonTap_: function() { | 131 onMenuButtonTap_: function() { |
| 129 this.$$('app-drawer').toggle(); | 132 this.$$('app-drawer').toggle(); |
| 130 }, | 133 }, |
| 131 | 134 |
| 132 /** @private */ | 135 /** @private */ |
| 133 directionDelegateChanged_: function() { | 136 directionDelegateChanged_: function() { |
| 134 this.$$('app-drawer').align = this.directionDelegate.isRtl() ? | 137 this.$$('app-drawer').align = this.directionDelegate.isRtl() ? |
| 135 'right' : 'left'; | 138 'right' : 'left'; |
| 136 }, | 139 }, |
| 137 }); | 140 }); |
| OLD | NEW |