OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DATA_USAGE_CORE_DATA_USE_H_ | 5 #ifndef COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_ |
6 #define COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_ | 6 #define COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "net/base/network_change_notifier.h" | 13 #include "net/base/network_change_notifier.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace data_usage { | 16 namespace data_usage { |
17 | 17 |
18 struct DataUse { | 18 struct DataUse { |
19 DataUse(const GURL& url, | 19 DataUse(const GURL& url, |
20 const base::TimeTicks& request_start, | 20 const base::TimeTicks& request_start, |
21 const GURL& first_party_for_cookies, | 21 const GURL& first_party_for_cookies, |
22 int32_t tab_id, | 22 int32_t tab_id, |
23 net::NetworkChangeNotifier::ConnectionType connection_type, | 23 net::NetworkChangeNotifier::ConnectionType connection_type, |
24 const std::string& mcc_mnc, | 24 const std::string& mcc_mnc, |
25 int64_t tx_bytes, | 25 int64_t tx_bytes, |
26 int64_t rx_bytes); | 26 int64_t rx_bytes); |
27 | 27 |
| 28 DataUse(const DataUse& other); |
| 29 |
28 ~DataUse(); | 30 ~DataUse(); |
29 | 31 |
30 bool operator==(const DataUse& other) const; | 32 bool operator==(const DataUse& other) const; |
31 | 33 |
32 // Returns true if |this| and |other| are identical except for byte counts. | 34 // Returns true if |this| and |other| are identical except for byte counts. |
33 bool CanCombineWith(const DataUse& other) const; | 35 bool CanCombineWith(const DataUse& other) const; |
34 | 36 |
35 GURL url; | 37 GURL url; |
36 // The TimeTicks when the request that is associated with these bytes was | 38 // The TimeTicks when the request that is associated with these bytes was |
37 // started. | 39 // started. |
38 base::TimeTicks request_start; | 40 base::TimeTicks request_start; |
39 GURL first_party_for_cookies; | 41 GURL first_party_for_cookies; |
40 int32_t tab_id; | 42 int32_t tab_id; |
41 net::NetworkChangeNotifier::ConnectionType connection_type; | 43 net::NetworkChangeNotifier::ConnectionType connection_type; |
42 // MCC+MNC (mobile country code + mobile network code) of the provider of the | 44 // MCC+MNC (mobile country code + mobile network code) of the provider of the |
43 // SIM when the network traffic was exchanged. Set to empty string if SIM is | 45 // SIM when the network traffic was exchanged. Set to empty string if SIM is |
44 // not present. |mcc_mnc| is set even if data was not exchanged on the | 46 // not present. |mcc_mnc| is set even if data was not exchanged on the |
45 // cellular network. For dual SIM phones, this is set to the MCC/MNC of the | 47 // cellular network. For dual SIM phones, this is set to the MCC/MNC of the |
46 // SIM in slot 0. | 48 // SIM in slot 0. |
47 std::string mcc_mnc; | 49 std::string mcc_mnc; |
48 | 50 |
49 int64_t tx_bytes; | 51 int64_t tx_bytes; |
50 int64_t rx_bytes; | 52 int64_t rx_bytes; |
51 }; | 53 }; |
52 | 54 |
53 } // namespace data_usage | 55 } // namespace data_usage |
54 | 56 |
55 #endif // COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_ | 57 #endif // COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_ |
OLD | NEW |