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

Side by Side Diff: components/data_usage/core/data_use.h

Issue 1421983002: Include tab IDs when reporting data use accounting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data_use_scoped_vector
Patch Set: Moved tab ID determination logic into data_usage codebase. Created 5 years, 1 month 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 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(); 28 ~DataUse();
29 29
30 bool operator==(const DataUse& other) const;
bengr 2015/11/05 00:00:38 One of your tests had a method to check if two Dat
sclittle 2015/11/05 01:22:48 I think you mean the ExpectDataUse function in tab
31
30 // Returns true if |this| and |other| are identical except for byte counts. 32 // Returns true if |this| and |other| are identical except for byte counts.
31 bool CanCombineWith(const DataUse& other) const; 33 bool CanCombineWith(const DataUse& other) const;
32 34
33 GURL url; 35 GURL url;
34 // The TimeTicks when the request that is associated with these bytes was 36 // The TimeTicks when the request that is associated with these bytes was
35 // started. 37 // started.
36 base::TimeTicks request_start; 38 base::TimeTicks request_start;
37 GURL first_party_for_cookies; 39 GURL first_party_for_cookies;
38 int32_t tab_id; 40 int32_t tab_id;
39 net::NetworkChangeNotifier::ConnectionType connection_type; 41 net::NetworkChangeNotifier::ConnectionType connection_type;
40 // MCC+MNC (mobile country code + mobile network code) of the provider of the 42 // MCC+MNC (mobile country code + mobile network code) of the provider of the
41 // SIM when the network traffic was exchanged. Set to empty string if SIM is 43 // SIM when the network traffic was exchanged. Set to empty string if SIM is
42 // not present. |mcc_mnc| is set even if data was not exchanged on the 44 // not present. |mcc_mnc| is set even if data was not exchanged on the
43 // cellular network. For dual SIM phones, this is set to the MCC/MNC of the 45 // cellular network. For dual SIM phones, this is set to the MCC/MNC of the
44 // SIM in slot 0. 46 // SIM in slot 0.
45 std::string mcc_mnc; 47 std::string mcc_mnc;
46 48
47 int64_t tx_bytes; 49 int64_t tx_bytes;
48 int64_t rx_bytes; 50 int64_t rx_bytes;
49 }; 51 };
50 52
51 } // namespace data_usage 53 } // namespace data_usage
52 54
53 #endif // COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_ 55 #endif // COMPONENTS_DATA_USAGE_CORE_DATA_USE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698