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

Unified Diff: components/offline_pages/background/device_conditions.h

Issue 2064323004: Defines initial DeviceConditions and and plumbs down through StartProcessing() call. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 6 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: components/offline_pages/background/device_conditions.h
diff --git a/components/offline_pages/background/device_conditions.h b/components/offline_pages/background/device_conditions.h
new file mode 100644
index 0000000000000000000000000000000000000000..e26c7d1289b0c57b9fab74b29522379ee57a11c2
--- /dev/null
+++ b/components/offline_pages/background/device_conditions.h
@@ -0,0 +1,42 @@
+// Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_
+#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_
+
+#include "net/base/network_change_notifier.h"
+
+namespace offline_pages {
+
+// Device network and power conditions.
+class DeviceConditions {
+ public:
+ DeviceConditions(
+ bool power_connected,
+ int battery_percentage,
+ net::NetworkChangeNotifier::ConnectionType net_connection_type)
+ : power_connected_(power_connected),
+ battery_percentage_(battery_percentage),
+ net_connection_type_(net_connection_type) {}
+
+ // Returns whether power is connected.
+ bool IsPowerConnected() const { return power_connected_; }
+
+ // Returns percentage of remaining battery power (0-100).
+ int GetBatteryPercentage() const { return battery_percentage_; }
+
+ // Returns the current type of network connection, if any.
+ net::NetworkChangeNotifier::ConnectionType GetNetConnectionType() const {
+ return net_connection_type_;
+ }
+
+ private:
+ const bool power_connected_;
+ const int battery_percentage_;
+ const net::NetworkChangeNotifier::ConnectionType net_connection_type_;
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_
« no previous file with comments | « components/offline_pages/background/BUILD.gn ('k') | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698