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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_
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"
16 // Shows battery status and power settings.
17 class PowerHandler
: public ::options::OptionsPageUIHandler
,
18 public ash::PowerStatus::Observer
{
21 ~PowerHandler() override
;
23 // OptionsPageUIHandler implementation.
24 void GetLocalizedValues(base::DictionaryValue
* localized_strings
) override
;
25 void InitializePage() override
;
26 void RegisterMessages() override
;
28 // ash::PowerStatus::Observer implementation.
29 void OnPowerStatusChanged() override
;
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;
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;
41 // Handler for the battery icon request.
42 void GetBatteryIcon(const base::ListValue
* args
);
44 DISALLOW_COPY_AND_ASSIGN(PowerHandler
);
47 } // namespace options
48 } // namespace chromeos
50 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_