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

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

Issue 2629573006: chromeos: Add Power device page to chrome://md-settings. (Closed)
Patch Set: update now that power source settings exist Created 3 years, 10 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 ab3ad88c5f30e4670f04179cd4ad12f5144b0438..3205d21242b925848660c7581e233151c6d08b93 100644
--- a/chrome/browser/resources/settings/device_page/device_page.js
+++ b/chrome/browser/resources/settings/device_page/device_page.js
@@ -26,22 +26,13 @@ Polymer({
* observers don't trigger until they have been populated.
* @private
*/
- hasMouse_: {
- type: Boolean,
- value: false
- },
+ hasMouse_: {type: Boolean, value: false},
Daniel Erat 2017/03/01 02:43:31 "git cl format --js" did this. let me know if you'
michaelpg 2017/03/01 05:20:38 no worries, but you'll actually need to rebase two
stevenjb 2017/03/01 17:19:43 Also, if you want this on multuple lines (and we g
Daniel Erat 2017/03/01 23:01:53 done (added trailing commas... it's going to be to
stevenjb 2017/03/01 23:15:38 Oh, BTW, this changed in ToT, you'll need to rebas
/** @private */
- hasTouchpad_: {
- type: Boolean,
- value: false
- },
+ hasTouchpad_: {type: Boolean, value: false},
/** @private */
- hasStylus_: {
- type: Boolean,
- value: false
- },
+ hasStylus_: {type: Boolean, value: false},
/**
* Whether power status and settings should be fetched and displayed.
@@ -54,43 +45,6 @@ Polymer({
},
readOnly: true,
},
-
- /** @private {string} ID of the selected power source, or ''. */
- selectedPowerSourceId_: String,
-
- /** @private {!settings.BatteryStatus|undefined} */
- batteryStatus_: Object,
-
- /** @private {boolean} Whether a low-power (USB) charger is being used. */
- lowPowerCharger_: Boolean,
-
- /**
- * List of available dual-role power sources, if enablePowerSettings_ is on.
- * @private {!Array<!settings.PowerSource>|undefined}
- */
- powerSources_: Array,
-
- /** @private */
- powerLabel_: {
- type: String,
- computed: 'computePowerLabel_(powerSources_, batteryStatus_.calculating)',
- },
-
- /** @private */
- showPowerDropdown_: {
- type: Boolean,
- computed: 'computeShowPowerDropdown_(powerSources_)',
- value: false,
- },
-
- /**
- * The name of the dedicated charging device being used, if present.
- * @private {string}
- */
- powerSourceName_: {
- type: String,
- computed: 'computePowerSourceName_(powerSources_, lowPowerCharger_)',
- },
},
observers: [
@@ -108,14 +62,6 @@ Polymer({
this.addWebUIListener(
'has-stylus-changed', this.set.bind(this, 'hasStylus_'));
settings.DevicePageBrowserProxyImpl.getInstance().initializeStylus();
-
- if (this.enablePowerSettings_) {
- this.addWebUIListener(
- 'battery-status-changed', this.set.bind(this, 'batteryStatus_'));
- this.addWebUIListener(
- 'power-sources-changed', this.powerSourcesChanged_.bind(this));
- settings.DevicePageBrowserProxyImpl.getInstance().updatePowerStatus();
- }
},
/**
@@ -133,52 +79,6 @@ Polymer({
},
/**
- * @param {*} lhs
- * @param {*} rhs
- * @return {boolean}
- */
- isEqual_: function(lhs, rhs) {
- return lhs === rhs;
- },
-
- /**
- * @param {!Array<!settings.PowerSource>|undefined} powerSources
- * @param {boolean} calculating
- * @return {string} The primary label for the power row.
- * @private
- */
- computePowerLabel_: function(powerSources, calculating) {
- return this.i18n(calculating ? 'calculatingPower' :
- powerSources.length ? 'powerSourceLabel' : 'powerSourceBattery');
- },
-
- /**
- * @param {!Array<!settings.PowerSource>} powerSources
- * @return {boolean} True if at least one power source is attached and all of
- * them are dual-role (no dedicated chargers).
- * @private
- */
- computeShowPowerDropdown_: function(powerSources) {
- return powerSources.length > 0 && powerSources.every(function(source) {
- return source.type == settings.PowerDeviceType.DUAL_ROLE_USB;
- });
- },
-
- /**
- * @param {!Array<!settings.PowerSource>} powerSources
- * @param {boolean} lowPowerCharger
- * @return {string} Description of the power source.
- * @private
- */
- computePowerSourceName_: function (powerSources, lowPowerCharger) {
- if (lowPowerCharger)
- return this.i18n('powerSourceLowPowerCharger');
- if (powerSources.length)
- return this.i18n('powerSourceAcAdapter');
- return '';
- },
-
- /**
* Handler for tapping the mouse and touchpad settings menu item.
* @private
*/
@@ -211,6 +111,14 @@ Polymer({
},
/**
+ * Handler for tapping the Power settings menu item.
+ * @private
+ */
+ onPowerTap_: function() {
michaelpg 2017/03/01 05:20:38 opt. nit: place in the same order as the HTML elem
Daniel Erat 2017/03/01 23:01:53 Done.
+ settings.navigateTo(settings.Route.POWER);
+ },
+
+ /**
* Handler for tapping the Storage settings menu item.
* @private
*/
@@ -218,11 +126,6 @@ Polymer({
settings.navigateTo(settings.Route.STORAGE);
},
- onPowerSourceChange_: function() {
- settings.DevicePageBrowserProxyImpl.getInstance().setPowerSource(
- this.$$('#powerSource').value);
- },
-
/** @protected */
currentRouteChanged: function() {
this.checkPointerSubpage_();
@@ -239,19 +142,6 @@ Polymer({
},
/**
- * @param {!Array<settings.PowerSource>} sources External power sources.
- * @param {string} selectedId The ID of the currently used power source.
- * @param {boolean} lowPowerCharger Whether the currently used power source
- * is a low-powered USB charger.
- * @private
- */
- powerSourcesChanged_: function(sources, selectedId, lowPowerCharger) {
- this.powerSources_ = sources;
- this.selectedPowerSourceId_ = selectedId;
- this.lowPowerCharger_ = lowPowerCharger;
- },
-
- /**
* Leaves the pointer subpage if all pointing devices are detached.
* @private
*/

Powered by Google App Engine
This is Rietveld 408576698