OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_OPTIONS_CHROMEOS_POWER_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_ |
| 7 |
| 8 #include "ash/system/chromeos/power/power_status.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" |
| 11 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 12 |
| 13 namespace chromeos { |
| 14 namespace options { |
| 15 |
| 16 // Shows battery status and power settings. |
| 17 class PowerHandler : public ::options::OptionsPageUIHandler, |
| 18 public ash::PowerStatus::Observer { |
| 19 public: |
| 20 PowerHandler(); |
| 21 ~PowerHandler() override; |
| 22 |
| 23 // OptionsPageUIHandler implementation. |
| 24 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 25 void InitializePage() override; |
| 26 void RegisterMessages() override; |
| 27 |
| 28 // ash::PowerStatus::Observer implementation. |
| 29 void OnPowerStatusChanged() override; |
| 30 |
| 31 private: |
| 32 // Gets the battery status text, showing the percentage and time remaining if |
| 33 // calculated. Returns an empty string if there is no battery. |
| 34 base::string16 GetStatusValue() const; |
| 35 |
| 36 // Helper function to get the battery status text, including the 'Battery' |
| 37 // label at the beginning. Wraps GetStatusValue(). Returns an empty string if |
| 38 // there is no battery. |
| 39 base::string16 GetFullStatusText() const; |
| 40 |
| 41 // Handler for the battery icon request. |
| 42 void GetBatteryIcon(const base::ListValue* args); |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(PowerHandler); |
| 45 }; |
| 46 |
| 47 } // namespace options |
| 48 } // namespace chromeos |
| 49 |
| 50 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_ |
OLD | NEW |