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

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

Issue 2110833003: MD Settings: Add mouse settings, update pointer settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PointersFake
Patch Set: Created 4 years, 6 months 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 f11e2a7db9cefbc6307500cdbc4327ad13c4ad2c..60361bed77ef3e810a10ade451ebcf873f575bbe 100644
--- a/chrome/browser/resources/settings/device_page/device_page.js
+++ b/chrome/browser/resources/settings/device_page/device_page.js
@@ -9,6 +9,11 @@
Polymer({
is: 'settings-device-page',
+ behaviors: [
+ I18nBehavior,
+ WebUIListenerBehavior,
+ ],
+
properties: {
/** The current active route. */
currentRoute: {
@@ -21,14 +26,78 @@ Polymer({
type: Object,
notify: true,
},
+
+ /** @private */
+ hasMouse_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /** @private */
+ hasTouchpad_: {
+ type: Boolean,
+ value: false,
+ },
+ },
+
+ ready: function() {
+ cr.addWebUIListener(
+ 'has-mouse-changed', this.hasMouseChanged_.bind(this));
+ cr.addWebUIListener(
+ 'has-touchpad-changed', this.hasTouchpadChanged_.bind(this));
+ settings.DevicePageBrowserProxyImpl.getInstance().initializePointers();
+ },
+
+ /**
+ * Callback to set whether a mouse is connected.
+ * @param {boolean} hasMouse
+ * @private
+ */
+ hasMouseChanged_: function(hasMouse) {
+ this.hasMouse_ = hasMouse;
+ },
+
+ /**
+ * Callback to set whether a touchpad is connected.
+ * @param {boolean} hasTouchpad
+ * @private
+ */
+ hasTouchpadChanged_: function(hasTouchpad) {
+ this.hasTouchpad_ = hasTouchpad;
+ },
stevenjb 2016/06/30 00:07:49 nit: Any reason not to just inline these two fairl
michaelpg 2016/07/09 04:11:30 Done.
+
+ /**
+ * @return {string}
+ * @private
+ */
+ getPointersTitle_: function() {
+ if (this.hasMouse_ && this.hasTouchpad_)
+ return this.i18n('mouseAndTouchpadTitle');
+ if (this.hasMouse_)
+ return this.i18n('mouseTitle');
+ if (this.hasTouchpad_)
+ return this.i18n('touchpadTitle');
+ return '';
+ },
+
+ /**
+ * @return {string}
+ * @private
+ */
+ getPointersIcon_: function() {
+ if (this.hasMouse_)
+ return 'settings:mouse';
+ if (this.hasTouchpad_)
+ return 'settings:touch-app';
+ return '';
},
/**
- * Handler for tapping the Touchpad settings menu item.
+ * Handler for tapping the mouse and touchpad settings menu item.
* @private
*/
- onTouchpadTap_: function() {
- this.$.pages.setSubpageChain(['touchpad']);
+ onPointersTap_: function() {
+ this.$.pages.setSubpageChain(['pointers']);
},
/**
@@ -46,4 +115,12 @@ Polymer({
onDisplayTap_: function() {
this.$.pages.setSubpageChain(['display']);
},
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ showPointers_: function(hasMouse, hasTouchpad) {
+ return hasMouse || hasTouchpad;
+ },
});

Powered by Google App Engine
This is Rietveld 408576698