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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_
7
8 #include "net/base/network_change_notifier.h"
9
10 namespace offline_pages {
11
12 // Device network and power conditions.
13 class DeviceConditions {
14 public:
15 DeviceConditions(
16 bool power_connected,
17 int battery_percentage,
18 net::NetworkChangeNotifier::ConnectionType net_connection_type)
19 : power_connected_(power_connected),
20 battery_percentage_(battery_percentage),
21 net_connection_type_(net_connection_type) {}
22
23 // Returns whether power is connected.
24 bool IsPowerConnected() const { return power_connected_; }
25
26 // Returns percentage of remaining battery power (0-100).
27 int GetBatteryPercentage() const { return battery_percentage_; }
28
29 // Returns the current type of network connection, if any.
30 net::NetworkChangeNotifier::ConnectionType GetNetConnectionType() const {
31 return net_connection_type_;
32 }
33
34 private:
35 const bool power_connected_;
36 const int battery_percentage_;
37 const net::NetworkChangeNotifier::ConnectionType net_connection_type_;
38 };
39
40 } // namespace offline_pages
41
42 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_
OLDNEW
« 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