| Index: components/data_use_measurement/core/data_use.h
|
| diff --git a/components/data_use_measurement/core/data_use.h b/components/data_use_measurement/core/data_use.h
|
| index 18e706dc6d4d40b45e151073bcb3d8df5c560f66..731e1cd0fb7a24578303cba634c26026e5a20cc4 100644
|
| --- a/components/data_use_measurement/core/data_use.h
|
| +++ b/components/data_use_measurement/core/data_use.h
|
| @@ -18,8 +18,25 @@ namespace data_use_measurement {
|
| // Class to store total network data used by some entity.
|
| class DataUse {
|
| public:
|
| - DataUse();
|
| - DataUse(const DataUse& other);
|
| + enum class TrafficType {
|
| + // Unknown type. URLRequests for arbitrary scheme such as blob, file,
|
| + // extensions, chrome URLs fall under this bucket - url/url_constants.cc
|
| + // TODO(rajendrant): Record metrics on the distribution of these type. It is
|
| + // also possible to remove this UNKNOWN type altogether by skipping the URL
|
| + // schemes that do not make use of network.
|
| + UNKNOWN,
|
| +
|
| + // User initiated traffic.
|
| + USER_TRAFFIC,
|
| +
|
| + // Chrome services.
|
| + SERVICES,
|
| +
|
| + // Fetch from ServiceWorker.
|
| + SERVICE_WORKER,
|
| + };
|
| +
|
| + explicit DataUse(TrafficType traffic_type);
|
| ~DataUse();
|
|
|
| // Merge data use from another instance.
|
| @@ -39,14 +56,21 @@ class DataUse {
|
|
|
| int64_t total_bytes_sent() const { return total_bytes_sent_; }
|
|
|
| + TrafficType traffic_type() const { return traffic_type_; }
|
| +
|
| private:
|
| + // TODO(rajendrant): Remove this friend after adding member function to
|
| + // increment total sent/received bytes.
|
| friend class DataUseRecorder;
|
|
|
| GURL url_;
|
| std::string description_;
|
| + const TrafficType traffic_type_;
|
|
|
| int64_t total_bytes_sent_;
|
| int64_t total_bytes_received_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DataUse);
|
| };
|
|
|
| } // namespace data_use_measurement
|
|
|