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 // Handler to request updating the power status.
37 void UpdatePowerStatus(const base::ListValue
* args
);
39 // Handler to change the power source.
40 void SetPowerSource(const base::ListValue
* args
);
42 // Updates the UI with the latest power source information.
43 void UpdatePowerSources();
45 // Whether the UI should show the power status.
46 bool show_power_status_
;
48 DISALLOW_COPY_AND_ASSIGN(PowerHandler
);
51 } // namespace options
52 } // namespace chromeos
54 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_