OLD | NEW |
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_DATA_USE_MEASUREMENT_CORE_DATA_USE_H_ | 5 #ifndef COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_H_ |
6 #define COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_H_ | 6 #define COMPONENTS_DATA_USE_MEASUREMENT_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/macros.h" | 12 #include "base/macros.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace data_use_measurement { | 16 namespace data_use_measurement { |
17 | 17 |
18 // Class to store total network data used by some entity. | 18 // Class to store total network data used by some entity. |
19 class DataUse { | 19 class DataUse { |
20 public: | 20 public: |
21 DataUse(); | 21 DataUse(); |
| 22 DataUse(const DataUse& other); |
22 ~DataUse(); | 23 ~DataUse(); |
23 | 24 |
24 // Merge data use from another instance. | 25 // Merge data use from another instance. |
25 void MergeFrom(const DataUse& other); | 26 void MergeFrom(const DataUse& other); |
26 | 27 |
27 const GURL& url() const { return url_; } | 28 const GURL& url() const { return url_; } |
28 | 29 |
29 void set_url(const GURL& url) { url_ = url; } | 30 void set_url(const GURL& url) { url_ = url; } |
30 | 31 |
31 const std::string& description() const { return description_; } | 32 const std::string& description() const { return description_; } |
32 | 33 |
33 void set_description(const std::string& description) { | 34 void set_description(const std::string& description) { |
34 description_ = description; | 35 description_ = description; |
35 } | 36 } |
36 | 37 |
37 int64_t total_bytes_received() const { return total_bytes_received_; } | 38 int64_t total_bytes_received() const { return total_bytes_received_; } |
38 | 39 |
39 int64_t total_bytes_sent() const { return total_bytes_sent_; } | 40 int64_t total_bytes_sent() const { return total_bytes_sent_; } |
40 | 41 |
41 private: | 42 private: |
42 friend class DataUseRecorder; | 43 friend class DataUseRecorder; |
43 | 44 |
44 GURL url_; | 45 GURL url_; |
45 std::string description_; | 46 std::string description_; |
46 | 47 |
47 int64_t total_bytes_sent_; | 48 int64_t total_bytes_sent_; |
48 int64_t total_bytes_received_; | 49 int64_t total_bytes_received_; |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(DataUse); | |
51 }; | 50 }; |
52 | 51 |
53 } // namespace data_use_measurement | 52 } // namespace data_use_measurement |
54 | 53 |
55 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_H_ | 54 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_H_ |
OLD | NEW |