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

Side by Side Diff: components/data_use_measurement/core/data_use_ascriber.h

Issue 2534023002: Create a DataUseRecorder instance for each page load in Chrome. (Closed)
Patch Set: Use emplace to insert; remove copy constructor Created 4 years 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 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_ASCRIBER_H_ 5 #ifndef COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_ASCRIBER_H_
6 #define COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_ASCRIBER_H_ 6 #define COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_ASCRIBER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 21 matching lines...) Expand all
32 public: 32 public:
33 virtual ~DataUseAscriber() {} 33 virtual ~DataUseAscriber() {}
34 34
35 // Creates a network delegate that will be used to track data use. 35 // Creates a network delegate that will be used to track data use.
36 std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate( 36 std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate(
37 std::unique_ptr<net::NetworkDelegate> wrapped_network_delegate, 37 std::unique_ptr<net::NetworkDelegate> wrapped_network_delegate,
38 const metrics::UpdateUsagePrefCallbackType& metrics_data_use_forwarder); 38 const metrics::UpdateUsagePrefCallbackType& metrics_data_use_forwarder);
39 39
40 // Returns the DataUseRecorder to which data usage for the given URL should 40 // Returns the DataUseRecorder to which data usage for the given URL should
41 // be ascribed. If no existing DataUseRecorder exists, a new one will be 41 // be ascribed. If no existing DataUseRecorder exists, a new one will be
42 // created. 42 // created only if |can_create_new| is true.
43 virtual DataUseRecorder* GetDataUseRecorder(net::URLRequest* request) = 0; 43 virtual DataUseRecorder* GetDataUseRecorder(net::URLRequest* request,
44 bool can_create_new) = 0;
45
46 // Returns a URLRequestClassifier that can classify requests for metrics
47 // recording.
48 virtual std::unique_ptr<URLRequestClassifier> CreateURLRequestClassifier()
49 const = 0;
44 50
45 // Methods called by DataUseNetworkDelegate to propagate data use information: 51 // Methods called by DataUseNetworkDelegate to propagate data use information:
46 virtual void OnBeforeUrlRequest(net::URLRequest* request); 52 virtual void OnBeforeUrlRequest(net::URLRequest* request);
47
48 virtual void OnBeforeRedirect(net::URLRequest* request,
49 const GURL& new_location);
50
51 virtual void OnNetworkBytesSent(net::URLRequest* request, int64_t bytes_sent); 53 virtual void OnNetworkBytesSent(net::URLRequest* request, int64_t bytes_sent);
52
53 virtual void OnNetworkBytesReceived(net::URLRequest* request, 54 virtual void OnNetworkBytesReceived(net::URLRequest* request,
54 int64_t bytes_received); 55 int64_t bytes_received);
55 56 virtual void OnUrlRequestCompleted(net::URLRequest* request, bool started);
56 virtual void OnUrlRequestDestroyed(net::URLRequest* request); 57 virtual void OnUrlRequestDestroyed(net::URLRequest* request);
57
58 virtual std::unique_ptr<URLRequestClassifier> CreateURLRequestClassifier()
59 const = 0;
60 }; 58 };
61 59
62 } // namespace data_use_measurement 60 } // namespace data_use_measurement
63 61
64 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_ASCRIBER_H_ 62 #endif // COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_ASCRIBER_H_
OLDNEW
« no previous file with comments | « components/data_use_measurement/core/data_use.cc ('k') | components/data_use_measurement/core/data_use_ascriber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698