Chromium Code Reviews| Index: chrome/browser/resources/settings/device_page/device_page.js |
| diff --git a/chrome/browser/resources/settings/device_page/device_page.js b/chrome/browser/resources/settings/device_page/device_page.js |
| index f286da702c4d0ceffa9469f8dceafffcbb6dbfd7..87249a2c3286f06418a0831ab8f2dc3633ec4eab 100644 |
| --- a/chrome/browser/resources/settings/device_page/device_page.js |
| +++ b/chrome/browser/resources/settings/device_page/device_page.js |
| @@ -22,17 +22,15 @@ Polymer({ |
| notify: true, |
| }, |
| - /** @private */ |
| - hasMouse_: { |
| - type: Boolean, |
| - value: false, |
| - }, |
| + /** |
| + * |hasMouse_| and |hasTouchpad_| start undefined so observers don't trigger |
| + * until both have been populated. |
| + * @private |
| + */ |
| + hasMouse_: Boolean, |
| /** @private */ |
| - hasTouchpad_: { |
| - type: Boolean, |
| - value: false, |
| - }, |
| + hasTouchpad_: Boolean, |
| /** @private */ |
| stylusAllowed_: { |
| @@ -49,12 +47,16 @@ Polymer({ |
| ], |
| ready: function() { |
| - cr.addWebUIListener('has-mouse-changed', this.set.bind(this, 'hasMouse_')); |
| - cr.addWebUIListener( |
| - 'has-touchpad-changed', this.set.bind(this, 'hasTouchpad_')); |
| settings.DevicePageBrowserProxyImpl.getInstance().initializePointers(); |
| }, |
| + attached: function() { |
|
dpapad
2016/12/16 01:20:53
Nit: @override
michaelpg
2016/12/16 23:32:30
Done + some other minor closure cleanup.
|
| + this.addWebUIListener( |
| + 'has-mouse-changed', this.set.bind(this, 'hasMouse_')); |
| + this.addWebUIListener( |
| + 'has-touchpad-changed', this.set.bind(this, 'hasTouchpad_')); |
| + }, |
| + |
| /** |
| * @return {string} |
| * @private |
| @@ -141,7 +143,8 @@ Polymer({ |
| * @private |
| */ |
| checkPointerSubpage_: function() { |
| - if (!this.hasMouse_ && !this.hasTouchpad_ && |
| + // Check that the properties have explicitly been set to false. |
| + if (this.hasMouse_ === false && this.hasTouchpad_ === false && |
| settings.getCurrentRoute() == settings.Route.POINTERS) { |
| settings.navigateTo(settings.Route.DEVICE); |
| } |