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', |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 this.$.pointersRow.hidden = !hasMouse && !hasTouchpad; | 133 this.$.pointersRow.hidden = !hasMouse && !hasTouchpad; |
134 this.checkPointerSubpage_(); | 134 this.checkPointerSubpage_(); |
135 }, | 135 }, |
136 | 136 |
137 /** | 137 /** |
138 * Leaves the pointer subpage if all pointing devices are detached. | 138 * Leaves the pointer subpage if all pointing devices are detached. |
139 * @private | 139 * @private |
140 */ | 140 */ |
141 checkPointerSubpage_: function() { | 141 checkPointerSubpage_: function() { |
142 if (!this.hasMouse_ && !this.hasTouchpad_ && | 142 if (!this.hasMouse_ && !this.hasTouchpad_ && |
143 this.isCurrentRouteOnPointersPage_()) { | 143 this.currentRoute == settings.Route.POINTERS) { |
144 this.$.pages.fire('subpage-back'); | 144 this.$.pages.fire('subpage-back'); |
145 } | 145 } |
146 }, | 146 }, |
147 | |
148 /** | |
149 * TODO(michaelpg): create generic fn for this and isCurrentRouteOnSyncPage_. | |
150 * @return {boolean} Whether the current route shows the pointers page. | |
151 * @private | |
152 */ | |
153 isCurrentRouteOnPointersPage_: function() { | |
154 return this.currentRoute && | |
155 this.currentRoute.page == 'basic' && | |
156 this.currentRoute.section == 'device' && | |
157 this.currentRoute.subpage.length == 1 && | |
158 this.currentRoute.subpage[0] == 'pointers'; | |
159 }, | |
160 }); | 147 }); |
OLD | NEW |