| 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 settings.RouteObserverBehavior, |
| 16 ], | 16 ], |
| 17 | 17 |
| 18 properties: { | 18 properties: { |
| 19 prefs: { | 19 prefs: { |
| 20 type: Object, | 20 type: Object, |
| 21 notify: true, | 21 notify: true, |
| 22 }, | 22 }, |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * |hasMouse_|, |hasTouchpad_|, and |hasStylus_| start undefined so | 25 * |hasMouse_| and |hasTouchpad_| start undefined so observers don't trigger |
| 26 * observers don't trigger until they have been populated. | 26 * until they have been populated. |
| 27 * @private | 27 * @private |
| 28 */ | 28 */ |
| 29 hasMouse_: { | 29 hasMouse_: Boolean, |
| 30 type: Boolean, | |
| 31 value: false | |
| 32 }, | |
| 33 | 30 |
| 34 /** @private */ | 31 /** @private */ |
| 35 hasTouchpad_: { | 32 hasTouchpad_: Boolean, |
| 36 type: Boolean, | |
| 37 value: false | |
| 38 }, | |
| 39 | 33 |
| 40 /** @private */ | 34 /** |
| 35 * |hasStylus_| is initialized to false so that dom-if behaves correctly. |
| 36 * @private |
| 37 */ |
| 41 hasStylus_: { | 38 hasStylus_: { |
| 42 type: Boolean, | 39 type: Boolean, |
| 43 value: false | 40 value: false, |
| 44 }, | 41 }, |
| 45 | 42 |
| 46 /** | 43 /** |
| 47 * Whether power status and settings should be fetched and displayed. | 44 * Whether power status and settings should be fetched and displayed. |
| 48 * @private | 45 * @private |
| 49 */ | 46 */ |
| 50 enablePowerSettings_: { | 47 enablePowerSettings_: { |
| 51 type: Boolean, | 48 type: Boolean, |
| 52 value: function() { | 49 value: function() { |
| 53 return loadTimeData.getBoolean('enablePowerSettings'); | 50 return loadTimeData.getBoolean('enablePowerSettings'); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return source.type == settings.PowerDeviceType.DUAL_ROLE_USB; | 160 return source.type == settings.PowerDeviceType.DUAL_ROLE_USB; |
| 164 }); | 161 }); |
| 165 }, | 162 }, |
| 166 | 163 |
| 167 /** | 164 /** |
| 168 * @param {!Array<!settings.PowerSource>} powerSources | 165 * @param {!Array<!settings.PowerSource>} powerSources |
| 169 * @param {boolean} lowPowerCharger | 166 * @param {boolean} lowPowerCharger |
| 170 * @return {string} Description of the power source. | 167 * @return {string} Description of the power source. |
| 171 * @private | 168 * @private |
| 172 */ | 169 */ |
| 173 computePowerSourceName_: function (powerSources, lowPowerCharger) { | 170 computePowerSourceName_: function(powerSources, lowPowerCharger) { |
| 174 if (lowPowerCharger) | 171 if (lowPowerCharger) |
| 175 return this.i18n('powerSourceLowPowerCharger'); | 172 return this.i18n('powerSourceLowPowerCharger'); |
| 176 if (powerSources.length) | 173 if (powerSources.length) |
| 177 return this.i18n('powerSourceAcAdapter'); | 174 return this.i18n('powerSourceAcAdapter'); |
| 178 return ''; | 175 return ''; |
| 179 }, | 176 }, |
| 180 | 177 |
| 181 /** | 178 /** |
| 182 * Handler for tapping the mouse and touchpad settings menu item. | 179 * Handler for tapping the mouse and touchpad settings menu item. |
| 183 * @private | 180 * @private |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 * @private | 253 * @private |
| 257 */ | 254 */ |
| 258 checkPointerSubpage_: function() { | 255 checkPointerSubpage_: function() { |
| 259 // Check that the properties have explicitly been set to false. | 256 // Check that the properties have explicitly been set to false. |
| 260 if (this.hasMouse_ === false && this.hasTouchpad_ === false && | 257 if (this.hasMouse_ === false && this.hasTouchpad_ === false && |
| 261 settings.getCurrentRoute() == settings.Route.POINTERS) { | 258 settings.getCurrentRoute() == settings.Route.POINTERS) { |
| 262 settings.navigateTo(settings.Route.DEVICE); | 259 settings.navigateTo(settings.Route.DEVICE); |
| 263 } | 260 } |
| 264 }, | 261 }, |
| 265 }); | 262 }); |
| OLD | NEW |