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

Unified Diff: chrome/browser/ui/webui/settings/chromeos/device_power_handler.h

Issue 2629173004: MD Settings: Dual-role charger selection (Closed)
Patch Set: rebase Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..09e6b0798c5d501401153e34ed17a1311673aa6a
--- /dev/null
+++ b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
@@ -0,0 +1,56 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DEVICE_POWER_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DEVICE_POWER_HANDLER_H_
+
+#include "ash/common/system/chromeos/power/power_status.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+
+namespace base {
+class ListValue;
+}
+
+namespace chromeos {
+namespace settings {
+
+// Chrome OS battery status and power settings handler.
+class PowerHandler : public ::settings::SettingsPageUIHandler,
+ public ash::PowerStatus::Observer {
+ public:
+ PowerHandler();
+ ~PowerHandler() override;
+
+ // SettingsPageUIHandler implementation.
+ void RegisterMessages() override;
+ void OnJavascriptAllowed() override;
+ void OnJavascriptDisallowed() override;
+
+ // ash::PowerStatus::Observer implementation.
+ void OnPowerStatusChanged() override;
+
+ private:
+ // Handler to request updating the power status.
+ void HandleUpdatePowerStatus(const base::ListValue* args);
+
+ // Handler to change the power source.
+ void HandleSetPowerSource(const base::ListValue* args);
+
+ // Updates the UI with the current battery status.
+ void SendBatteryStatus();
+
+ // Updates the UI with a list of available dual-role power sources.
+ void SendPowerSources();
+
+ ash::PowerStatus* power_status_;
+
+ DISALLOW_COPY_AND_ASSIGN(PowerHandler);
+};
+
+} // namespace settings
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DEVICE_POWER_HANDLER_H_
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698