| 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_| and |hasTouchpad_| start undefined so observers don't trigger | 25 * |hasMouse_|, |hasTouchpad_|, and |hasStylus_| start undefined so |
| 26 * until both have been populated. | 26 * observers don't trigger until they have been populated. |
| 27 * @private | 27 * @private |
| 28 */ | 28 */ |
| 29 hasMouse_: Boolean, | 29 hasMouse_: { |
| 30 type: Boolean, |
| 31 value: false |
| 32 }, |
| 30 | 33 |
| 31 /** @private */ | 34 /** @private */ |
| 32 hasTouchpad_: Boolean, | 35 hasTouchpad_: { |
| 36 type: Boolean, |
| 37 value: false |
| 38 }, |
| 33 | 39 |
| 34 /** @private */ | 40 /** @private */ |
| 35 stylusAllowed_: { | 41 hasStylus_: { |
| 36 type: Boolean, | 42 type: Boolean, |
| 37 value: function() { | 43 value: false |
| 38 return loadTimeData.getBoolean('stylusAllowed'); | |
| 39 }, | |
| 40 readOnly: true, | |
| 41 }, | 44 }, |
| 42 | 45 |
| 43 /** | 46 /** |
| 44 * Whether power status and settings should be fetched and displayed. | 47 * Whether power status and settings should be fetched and displayed. |
| 45 * @private | 48 * @private |
| 46 */ | 49 */ |
| 47 enablePowerSettings_: { | 50 enablePowerSettings_: { |
| 48 type: Boolean, | 51 type: Boolean, |
| 49 value: function() { | 52 value: function() { |
| 50 return loadTimeData.getBoolean('enablePowerSettings'); | 53 return loadTimeData.getBoolean('enablePowerSettings'); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ], | 105 ], |
| 103 | 106 |
| 104 /** @override */ | 107 /** @override */ |
| 105 attached: function() { | 108 attached: function() { |
| 106 this.addWebUIListener( | 109 this.addWebUIListener( |
| 107 'has-mouse-changed', this.set.bind(this, 'hasMouse_')); | 110 'has-mouse-changed', this.set.bind(this, 'hasMouse_')); |
| 108 this.addWebUIListener( | 111 this.addWebUIListener( |
| 109 'has-touchpad-changed', this.set.bind(this, 'hasTouchpad_')); | 112 'has-touchpad-changed', this.set.bind(this, 'hasTouchpad_')); |
| 110 settings.DevicePageBrowserProxyImpl.getInstance().initializePointers(); | 113 settings.DevicePageBrowserProxyImpl.getInstance().initializePointers(); |
| 111 | 114 |
| 115 this.addWebUIListener( |
| 116 'has-stylus-changed', this.set.bind(this, 'hasStylus_')); |
| 117 settings.DevicePageBrowserProxyImpl.getInstance().initializeStylus(); |
| 118 |
| 112 if (this.enablePowerSettings_) { | 119 if (this.enablePowerSettings_) { |
| 113 this.addWebUIListener( | 120 this.addWebUIListener( |
| 114 'battery-status-changed', this.set.bind(this, 'batteryStatus_')); | 121 'battery-status-changed', this.set.bind(this, 'batteryStatus_')); |
| 115 this.addWebUIListener( | 122 this.addWebUIListener( |
| 116 'power-sources-changed', this.powerSourcesChanged_.bind(this)); | 123 'power-sources-changed', this.powerSourcesChanged_.bind(this)); |
| 117 settings.DevicePageBrowserProxyImpl.getInstance().updatePowerStatus(); | 124 settings.DevicePageBrowserProxyImpl.getInstance().updatePowerStatus(); |
| 118 } | 125 } |
| 119 }, | 126 }, |
| 120 | 127 |
| 121 /** | 128 /** |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 * @private | 312 * @private |
| 306 */ | 313 */ |
| 307 checkPointerSubpage_: function() { | 314 checkPointerSubpage_: function() { |
| 308 // Check that the properties have explicitly been set to false. | 315 // Check that the properties have explicitly been set to false. |
| 309 if (this.hasMouse_ === false && this.hasTouchpad_ === false && | 316 if (this.hasMouse_ === false && this.hasTouchpad_ === false && |
| 310 settings.getCurrentRoute() == settings.Route.POINTERS) { | 317 settings.getCurrentRoute() == settings.Route.POINTERS) { |
| 311 settings.navigateTo(settings.Route.DEVICE); | 318 settings.navigateTo(settings.Route.DEVICE); |
| 312 } | 319 } |
| 313 }, | 320 }, |
| 314 }); | 321 }); |
| OLD | NEW |