Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3088)

Unified Diff: chrome/browser/resources/settings/device_page/device_page.js

Issue 2585573002: Allow navigation to chrome://md-settings/pointer-overlay (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..18f39843cb4200b4926ae776c14a8424fdc261eb 100644
--- a/chrome/browser/resources/settings/device_page/device_page.js
+++ b/chrome/browser/resources/settings/device_page/device_page.js
@@ -16,23 +16,20 @@ Polymer({
],
properties: {
- /** Preferences state. */
prefs: {
type: Object,
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_: {
@@ -48,13 +45,19 @@ Polymer({
'pointersChanged_(hasMouse_, hasTouchpad_)',
],
+ /** @override */
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();
},
+ /** @override */
+ attached: function() {
+ 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 +144,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);
}

Powered by Google App Engine
This is Rietveld 408576698