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

Unified Diff: content/browser/battery_status/battery_status_manager_linux.h

Issue 436683002: Battery Status API: implementation for Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix BUILD.gn Created 6 years, 4 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: content/browser/battery_status/battery_status_manager_linux.h
diff --git a/content/browser/battery_status/battery_status_manager_linux.h b/content/browser/battery_status/battery_status_manager_linux.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb42bf42a6e495f9479740bfa8536bfe5b9f6580
--- /dev/null
+++ b/content/browser/battery_status/battery_status_manager_linux.h
@@ -0,0 +1,35 @@
+// 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_BATTERY_STATUS_BATTERY_STATUS_MANAGER_LINUX_H_
+#define CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_LINUX_H_
+
+#include "content/browser/battery_status/battery_status_manager.h"
hashimoto 2014/08/11 08:19:15 nit: No need to include this.
timvolodine 2014/08/11 16:03:00 this is needed due to BatteryStatusManager::Create
hashimoto 2014/08/12 10:01:43 Should be included in battery_status_manager_linux
timvolodine 2014/08/12 19:27:53 Done. although it looks a bit weird to include two
+#include "content/common/content_export.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace content {
+
+// UPowerDeviceState reflects the possible UPower.Device.State values,
+// see upower.freedesktop.org/docs/Device.html#Device:State.
+enum UPowerDeviceState {
+ UPOWER_DEVICE_STATE_UNKNOWN = 0,
+ UPOWER_DEVICE_STATE_CHARGING = 1,
+ UPOWER_DEVICE_STATE_DISCHARGING = 2,
+ UPOWER_DEVICE_STATE_EMPTY = 3,
+ UPOWER_DEVICE_STATE_FULL = 4,
+ UPOWER_DEVICE_STATE_PENDING_CHARGE = 5,
+ UPOWER_DEVICE_STATE_PENDING_DISCHARGE = 6,
+};
+
+// Computes and sets the WebBatteryStatus values where possible based on the
+// provided dictionary.
+CONTENT_EXPORT void ComputeWebBatteryStatus(
+ const base::DictionaryValue& dictionary, blink::WebBatteryStatus& status);
hashimoto 2014/08/11 08:19:16 Our style guide prohibits use of non-const referen
timvolodine 2014/08/11 16:03:00 Done. made it return a scoped_ptr.
hashimoto 2014/08/12 10:01:43 WebBatteryStatus is a copyable class. Why does thi
timvolodine 2014/08/12 19:27:53 I was actually trying to avoid a copy, but the com
hashimoto 2014/08/13 11:02:20 Why do you care about a copy here when you allocat
timvolodine 2014/08/13 16:58:08 well, the empty dictionary is a special case (i.e.
+
+} // namespace content
+
+#endif // CHROME_BROWSER_BATTERY_STATUS_BATTERY_STATUS_MANAGER_LINUX_H_

Powered by Google App Engine
This is Rietveld 408576698