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

Side by Side Diff: components/offline_pages/core/background/device_conditions.h

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_DEVICE_CONDITIONS_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_DEVICE_CONDITIONS_H_
7 7
8 #include "net/base/network_change_notifier.h" 8 #include "net/base/network_change_notifier.h"
9 9
10 namespace offline_pages { 10 namespace offline_pages {
11 11
12 // Device network and power conditions. 12 // Device network and power conditions.
13 class DeviceConditions { 13 class DeviceConditions {
14 public: 14 public:
15 DeviceConditions( 15 DeviceConditions(
16 bool power_connected, 16 bool power_connected,
17 int battery_percentage, 17 int battery_percentage,
18 net::NetworkChangeNotifier::ConnectionType net_connection_type) 18 net::NetworkChangeNotifier::ConnectionType net_connection_type)
19 : power_connected_(power_connected), 19 : power_connected_(power_connected),
20 battery_percentage_(battery_percentage), 20 battery_percentage_(battery_percentage),
21 net_connection_type_(net_connection_type) {} 21 net_connection_type_(net_connection_type) {}
22 22
23 DeviceConditions() 23 DeviceConditions()
24 : power_connected_(true), battery_percentage_(75), 24 : power_connected_(true),
25 battery_percentage_(75),
25 net_connection_type_(net::NetworkChangeNotifier::CONNECTION_WIFI) {} 26 net_connection_type_(net::NetworkChangeNotifier::CONNECTION_WIFI) {}
26 27
27 // Returns whether power is connected. 28 // Returns whether power is connected.
28 bool IsPowerConnected() const { return power_connected_; } 29 bool IsPowerConnected() const { return power_connected_; }
29 30
30 // Returns percentage of remaining battery power (0-100). 31 // Returns percentage of remaining battery power (0-100).
31 int GetBatteryPercentage() const { return battery_percentage_; } 32 int GetBatteryPercentage() const { return battery_percentage_; }
32 33
33 // Returns the current type of network connection, if any. 34 // Returns the current type of network connection, if any.
34 net::NetworkChangeNotifier::ConnectionType GetNetConnectionType() const { 35 net::NetworkChangeNotifier::ConnectionType GetNetConnectionType() const {
35 return net_connection_type_; 36 return net_connection_type_;
36 } 37 }
37 38
38 private: 39 private:
39 const bool power_connected_; 40 const bool power_connected_;
40 const int battery_percentage_; 41 const int battery_percentage_;
41 const net::NetworkChangeNotifier::ConnectionType net_connection_type_; 42 const net::NetworkChangeNotifier::ConnectionType net_connection_type_;
42 43
43 // NOTE: We intentionally allow the default copy constructor and assignment. 44 // NOTE: We intentionally allow the default copy constructor and assignment.
44 }; 45 };
45 46
46 } // namespace offline_pages 47 } // namespace offline_pages
47 48
48 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_DEVICE_CONDITIONS_H_ 49 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_DEVICE_CONDITIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698