Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4309)

Unified Diff: chrome/browser/ui/webui/options/chromeos/power_handler.h

Issue 677983004: Power overlay in Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/chromeos/power_handler.h
diff --git a/chrome/browser/ui/webui/options/chromeos/power_handler.h b/chrome/browser/ui/webui/options/chromeos/power_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..8407a63f05a33ce40aa04afebc883bec406109b8
--- /dev/null
+++ b/chrome/browser/ui/webui/options/chromeos/power_handler.h
@@ -0,0 +1,50 @@
+// Copyright 2014 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_OPTIONS_CHROMEOS_POWER_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_
+
+#include "ash/system/chromeos/power/power_status.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "chrome/browser/ui/webui/options/options_ui.h"
+
+namespace chromeos {
+namespace options {
+
+// Shows battery status and power settings.
+class PowerHandler : public ::options::OptionsPageUIHandler,
+ public ash::PowerStatus::Observer {
+ public:
+ PowerHandler();
+ ~PowerHandler() override;
+
+ // OptionsPageUIHandler implementation.
+ void GetLocalizedValues(base::DictionaryValue* localized_strings) override;
+ void InitializePage() override;
+ void RegisterMessages() override;
+
+ // ash::PowerStatus::Observer implementation.
+ void OnPowerStatusChanged() override;
+
+private:
+ // Gets the battery status text, showing the percentage and time remaining if
+ // calculated. Returns an empty string if there is no battery.
+ base::string16 GetStatusValue() const;
+
+ // Helper function to get the battery status text, including the 'Battery'
+ // label at the beginning. Wraps GetStatusValue(). Returns an empty string if
+ // there is no battery.
+ base::string16 GetFullStatusText() const;
+
+ // Handler for the battery icon request.
+ void GetBatteryIcon(const base::ListValue* args);
+
+ DISALLOW_COPY_AND_ASSIGN(PowerHandler);
+};
+
+} // namespace options
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_POWER_HANDLER_H_
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.cc ('k') | chrome/browser/ui/webui/options/chromeos/power_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698