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

Unified Diff: chrome/browser/resources/options/browser_options.js

Issue 677983004: Power overlay in Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/options/browser_options.js
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index 2a4630562561e1411f2980dfefea589d497dfe03..ee0819c086dd04e5f0c08938503fa776195ec4ea 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -269,6 +269,11 @@ cr.define('options', function() {
// Device section (ChromeOS only).
if (cr.isChromeOS) {
+ $('power-settings-button').onclick = function(evt) {
+ PageManager.showPageByName('power-overlay');
+ chrome.send('coreOptionsUserMetricsAction',
+ ['Options_ShowPowerSettings']);
+ };
$('battery-button').onclick = function(evt) {
WebsiteSettingsManager.showWebsiteSettings('battery');
};
@@ -1979,6 +1984,29 @@ cr.define('options', function() {
else
element.disabled = false;
},
+
+ /**
+ * Sets the icon in the battery section.
+ * @param {string} iconData The data representing the icon to display.
+ * @private
+ */
+ setBatteryIcon_: function(iconData) {
+ $('battery-icon').style.backgroundImage = 'url(' + iconData + ')';
+ $('battery-icon').hidden = false;
+ },
+
+ /**
+ * Sets the text for the battery section.
+ * @param {string} statusText The battery status, with a relevant label.
+ * @private
+ */
+ setBatteryStatusText_: function(statusText) {
+ $('battery').hidden = !statusText.length;
+ if (statusText.length) {
+ $('battery-status').textContent = statusText;
+ chrome.send('requestBatteryIcon');
+ }
+ },
};
//Forward public APIs to private implementations.
@@ -1997,6 +2025,8 @@ cr.define('options', function() {
'setAccountPictureManaged',
'setWallpaperManaged',
'setAutoOpenFileTypesDisplayed',
+ 'setBatteryIcon',
+ 'setBatteryStatusText',
'setBluetoothState',
'setCanSetTime',
'setFontSize',
« no previous file with comments | « chrome/browser/resources/options/browser_options.html ('k') | chrome/browser/resources/options/chromeos/power_overlay.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698