Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 'settings-device-page' is the settings page for device and | 6 * @fileoverview 'settings-device-page' is the settings page for device and |
| 7 * peripheral settings. | 7 * peripheral settings. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-device-page', | 10 is: 'settings-device-page', |
| 11 | 11 |
| 12 behaviors: [ | 12 behaviors: [ |
| 13 I18nBehavior, | 13 I18nBehavior, |
| 14 WebUIListenerBehavior, | 14 WebUIListenerBehavior, |
| 15 settings.RouteObserverBehavior, | |
| 15 ], | 16 ], |
| 16 | 17 |
| 17 properties: { | 18 properties: { |
| 18 /** The current active route. */ | |
| 19 currentRoute: { | |
| 20 type: Object, | |
| 21 notify: true, | |
| 22 observers: 'currentRouteChanged_', | |
| 23 }, | |
| 24 | |
| 25 /** Preferences state. */ | 19 /** Preferences state. */ |
| 26 prefs: { | 20 prefs: { |
| 27 type: Object, | 21 type: Object, |
| 28 notify: true, | 22 notify: true, |
| 29 }, | 23 }, |
| 30 | 24 |
| 31 /** @private */ | 25 /** @private */ |
| 32 hasMouse_: { | 26 hasMouse_: { |
| 33 type: Boolean, | 27 type: Boolean, |
| 34 value: false, | 28 value: false, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 }, | 106 }, |
| 113 | 107 |
| 114 /** | 108 /** |
| 115 * Handler for tapping the Display settings menu item. | 109 * Handler for tapping the Display settings menu item. |
| 116 * @private | 110 * @private |
| 117 */ | 111 */ |
| 118 onDisplayTap_: function() { | 112 onDisplayTap_: function() { |
| 119 settings.navigateTo(settings.Route.DISPLAY); | 113 settings.navigateTo(settings.Route.DISPLAY); |
| 120 }, | 114 }, |
| 121 | 115 |
| 122 /** @private */ | 116 /** @protected */ |
|
Dan Beam
2016/08/05 18:25:18
can this be @override instead?
tommycli
2016/08/05 18:54:05
Unfortunately, no. RouteObserverBehavior is not de
| |
| 123 currentRouteChanged_: function() { | 117 currentRouteChanged: function() { |
| 124 this.checkPointerSubpage_(); | 118 this.checkPointerSubpage_(); |
| 125 }, | 119 }, |
| 126 | 120 |
| 127 /** | 121 /** |
| 128 * @param {boolean} hasMouse | 122 * @param {boolean} hasMouse |
| 129 * @param {boolean} hasTouchpad | 123 * @param {boolean} hasTouchpad |
| 130 * @private | 124 * @private |
| 131 */ | 125 */ |
| 132 pointersChanged_: function(hasMouse, hasTouchpad) { | 126 pointersChanged_: function(hasMouse, hasTouchpad) { |
| 133 this.$.pointersRow.hidden = !hasMouse && !hasTouchpad; | 127 this.$.pointersRow.hidden = !hasMouse && !hasTouchpad; |
| 134 this.checkPointerSubpage_(); | 128 this.checkPointerSubpage_(); |
| 135 }, | 129 }, |
| 136 | 130 |
| 137 /** | 131 /** |
| 138 * Leaves the pointer subpage if all pointing devices are detached. | 132 * Leaves the pointer subpage if all pointing devices are detached. |
| 139 * @private | 133 * @private |
| 140 */ | 134 */ |
| 141 checkPointerSubpage_: function() { | 135 checkPointerSubpage_: function() { |
| 142 if (!this.hasMouse_ && !this.hasTouchpad_ && | 136 if (!this.hasMouse_ && !this.hasTouchpad_ && |
| 143 this.currentRoute == settings.Route.POINTERS) { | 137 settings.getCurrentRoute() == settings.Route.POINTERS) { |
| 144 this.$.pages.fire('subpage-back'); | 138 this.$.pages.fire('subpage-back'); |
| 145 } | 139 } |
| 146 }, | 140 }, |
| 147 }); | 141 }); |
| OLD | NEW |