| 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> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const GURL& url() const { return url_; } | 49 const GURL& url() const { return url_; } |
| 50 | 50 |
| 51 void set_url(const GURL& url) { url_ = url; } | 51 void set_url(const GURL& url) { url_ = url; } |
| 52 | 52 |
| 53 const std::string& description() const { return description_; } | 53 const std::string& description() const { return description_; } |
| 54 | 54 |
| 55 void set_description(const std::string& description) { | 55 void set_description(const std::string& description) { |
| 56 description_ = description; | 56 description_ = description; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Increments the total received and sent byte counts. Can be used to |
| 60 // decrement the byte counts as well. |
| 61 void IncrementTotalBytes(int64_t bytes_received, int64_t bytes_sent); |
| 62 |
| 59 int64_t total_bytes_received() const { return total_bytes_received_; } | 63 int64_t total_bytes_received() const { return total_bytes_received_; } |
| 60 | 64 |
| 61 int64_t total_bytes_sent() const { return total_bytes_sent_; } | 65 int64_t total_bytes_sent() const { return total_bytes_sent_; } |
| 62 | 66 |
| 63 TrafficType traffic_type() const { return traffic_type_; } | 67 TrafficType traffic_type() const { return traffic_type_; } |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 // TODO(rajendrant): Remove this friend after adding member function to | |
| 67 // increment total sent/received bytes. | |
| 68 friend class DataUseRecorder; | |
| 69 | |
| 70 GURL url_; | 70 GURL url_; |
| 71 std::string description_; | 71 std::string description_; |
| 72 const TrafficType traffic_type_; | 72 const TrafficType traffic_type_; |
| 73 | 73 |
| 74 int64_t total_bytes_sent_; | 74 int64_t total_bytes_sent_; |
| 75 int64_t total_bytes_received_; | 75 int64_t total_bytes_received_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(DataUse); | 77 DISALLOW_COPY_AND_ASSIGN(DataUse); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace data_use_measurement | 80 } // namespace data_use_measurement |
| 81 | 81 |
| 82 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_H_ | 82 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_H_ |
| OLD | NEW |