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_: Boolean, |
30 | 30 |
31 /** @private */ | 31 /** @private */ |
32 hasTouchpad_: Boolean, | 32 hasTouchpad_: Boolean, |
33 | 33 |
34 /** @private */ | 34 /** @private */ |
35 stylusAllowed_: { | 35 hasStylus_: Boolean, |
stevenjb
2017/02/03 23:11:26
This should actually initialize to 'false', otherw
jdufault
2017/02/06 21:44:41
Done; I was following the pattern for hasMouse_ an
| |
36 type: Boolean, | |
37 value: function() { | |
38 return loadTimeData.getBoolean('stylusAllowed'); | |
39 }, | |
40 readOnly: true, | |
41 }, | |
42 | 36 |
43 /** | 37 /** |
44 * Whether power status and settings should be fetched and displayed. | 38 * Whether power status and settings should be fetched and displayed. |
45 * @private | 39 * @private |
46 */ | 40 */ |
47 enablePowerSettings_: { | 41 enablePowerSettings_: { |
48 type: Boolean, | 42 type: Boolean, |
49 value: function() { | 43 value: function() { |
50 return loadTimeData.getBoolean('enablePowerSettings'); | 44 return loadTimeData.getBoolean('enablePowerSettings'); |
51 }, | 45 }, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 ], | 96 ], |
103 | 97 |
104 /** @override */ | 98 /** @override */ |
105 attached: function() { | 99 attached: function() { |
106 this.addWebUIListener( | 100 this.addWebUIListener( |
107 'has-mouse-changed', this.set.bind(this, 'hasMouse_')); | 101 'has-mouse-changed', this.set.bind(this, 'hasMouse_')); |
108 this.addWebUIListener( | 102 this.addWebUIListener( |
109 'has-touchpad-changed', this.set.bind(this, 'hasTouchpad_')); | 103 'has-touchpad-changed', this.set.bind(this, 'hasTouchpad_')); |
110 settings.DevicePageBrowserProxyImpl.getInstance().initializePointers(); | 104 settings.DevicePageBrowserProxyImpl.getInstance().initializePointers(); |
111 | 105 |
106 this.addWebUIListener( | |
107 'has-stylus-changed', this.set.bind(this, 'hasStylus_')); | |
108 settings.DevicePageBrowserProxyImpl.getInstance().initializeStylus(); | |
109 | |
112 if (this.enablePowerSettings_) { | 110 if (this.enablePowerSettings_) { |
113 this.addWebUIListener( | 111 this.addWebUIListener( |
114 'battery-status-changed', this.set.bind(this, 'batteryStatus_')); | 112 'battery-status-changed', this.set.bind(this, 'batteryStatus_')); |
115 this.addWebUIListener( | 113 this.addWebUIListener( |
116 'power-sources-changed', this.powerSourcesChanged_.bind(this)); | 114 'power-sources-changed', this.powerSourcesChanged_.bind(this)); |
117 settings.DevicePageBrowserProxyImpl.getInstance().updatePowerStatus(); | 115 settings.DevicePageBrowserProxyImpl.getInstance().updatePowerStatus(); |
118 } | 116 } |
119 }, | 117 }, |
120 | 118 |
121 /** | 119 /** |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 * @private | 303 * @private |
306 */ | 304 */ |
307 checkPointerSubpage_: function() { | 305 checkPointerSubpage_: function() { |
308 // Check that the properties have explicitly been set to false. | 306 // Check that the properties have explicitly been set to false. |
309 if (this.hasMouse_ === false && this.hasTouchpad_ === false && | 307 if (this.hasMouse_ === false && this.hasTouchpad_ === false && |
310 settings.getCurrentRoute() == settings.Route.POINTERS) { | 308 settings.getCurrentRoute() == settings.Route.POINTERS) { |
311 settings.navigateTo(settings.Route.DEVICE); | 309 settings.navigateTo(settings.Route.DEVICE); |
312 } | 310 } |
313 }, | 311 }, |
314 }); | 312 }); |
OLD | NEW |