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

Unified Diff: components/data_use_measurement/core/data_use_ascriber.h

Issue 2354323002: Propagate network delegate events to ChromeDataUseAscriber. (Closed)
Patch Set: new lines Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: components/data_use_measurement/core/data_use_ascriber.h
diff --git a/components/data_use_measurement/core/data_use_ascriber.h b/components/data_use_measurement/core/data_use_ascriber.h
index a4d6300731a5fcb2c2a6acdf23cbb95c90437042..67e70e6b8352458e96a3e4afdd458d5d4e9b2e98 100644
--- a/components/data_use_measurement/core/data_use_ascriber.h
+++ b/components/data_use_measurement/core/data_use_ascriber.h
@@ -5,7 +5,14 @@
#ifndef COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_ASCRIBER_H_
#define COMPONENTS_DATA_USE_MEASUREMENT_CORE_DATA_USE_ASCRIBER_H_
+#include <stdint.h>
+
+#include <memory>
+
+#include "url/gurl.h"
+
namespace net {
+class NetworkDelegate;
class URLRequest;
}
@@ -22,11 +29,28 @@ class DataUseAscriber {
public:
virtual ~DataUseAscriber() {}
+ // Creates a network delegate that will be used to track data use.
+ std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate(
+ std::unique_ptr<net::NetworkDelegate> wrapped_network_delegate);
+
// Returns the DataUseRecorder to which data usage for the given URL should
// be ascribed. If no existing DataUseRecorder exists, a new one will be
// created.
virtual DataUseRecorder* GetDataUseRecorder(
const net::URLRequest* request) = 0;
+
+ // Methods called by DataUseNetworkDelegate to propagate data use information:
+ virtual void OnBeforeUrlRequest(net::URLRequest* request);
+
+ virtual void OnBeforeRedirect(net::URLRequest* request,
+ const GURL& new_location);
+
+ virtual void OnNetworkBytesSent(net::URLRequest* request, int64_t bytes_sent);
+
+ virtual void OnNetworkBytesReceived(net::URLRequest* request,
+ int64_t bytes_received);
+
+ virtual void OnUrlRequestCompleted(net::URLRequest* request, bool started);
};
} // namespace data_use_measurement
« no previous file with comments | « components/data_use_measurement/core/BUILD.gn ('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