Chromium Code Reviews| 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..dfc04fb00b9bc5b24d0458a24f8cbb295d6ba92a |
| --- /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; |
| + |
| + private: |
| + // ash::PowerStatus::Observer implementation. |
| + void OnPowerStatusChanged() override; |
|
stevenjb
2017/01/13 17:22:42
Why private?
michaelpg
2017/01/13 18:52:03
why not?
stevenjb
2017/01/13 18:58:55
Why make this private and not the SettingsPageUIHa
michaelpg
2017/01/13 22:21:40
OK, keeping it public makes more sense. I have a v
|
| + |
| + // 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_ |