Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DEVICE_POWER_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DEVICE_POWER_HANDLER_H_ | |
| 7 | |
| 8 #include "ash/common/system/chromeos/power/power_status.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/strings/string16.h" | |
| 11 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class ListValue; | |
| 15 } | |
| 16 | |
| 17 namespace chromeos { | |
| 18 namespace settings { | |
| 19 | |
| 20 // Chrome OS battery status and power settings handler. | |
| 21 class PowerHandler : public ::settings::SettingsPageUIHandler, | |
| 22 public ash::PowerStatus::Observer { | |
| 23 public: | |
| 24 PowerHandler(); | |
| 25 ~PowerHandler() override; | |
| 26 | |
| 27 // SettingsPageUIHandler implementation. | |
| 28 void RegisterMessages() override; | |
| 29 void OnJavascriptAllowed() override; | |
| 30 void OnJavascriptDisallowed() override; | |
| 31 | |
| 32 private: | |
| 33 // ash::PowerStatus::Observer implementation. | |
| 34 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
| |
| 35 | |
| 36 // Handler to request updating the power status. | |
| 37 void HandleUpdatePowerStatus(const base::ListValue* args); | |
| 38 | |
| 39 // Handler to change the power source. | |
| 40 void HandleSetPowerSource(const base::ListValue* args); | |
| 41 | |
| 42 // Updates the UI with the current battery status. | |
| 43 void SendBatteryStatus(); | |
| 44 | |
| 45 // Updates the UI with a list of available dual-role power sources. | |
| 46 void SendPowerSources(); | |
| 47 | |
| 48 ash::PowerStatus* power_status_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(PowerHandler); | |
| 51 }; | |
| 52 | |
| 53 } // namespace settings | |
| 54 } // namespace chromeos | |
| 55 | |
| 56 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DEVICE_POWER_HANDLER_H_ | |
| OLD | NEW |