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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc

Issue 2953523002: Add 'Other' category on the Data Saver site-breakdown page (Closed)
Patch Set: fixed message description Created 3 years, 6 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
« no previous file with comments | « chrome/android/java/strings/android_chrome_strings.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc
index b7683d292a91ac57443e4759d254b7df9cccb317..3812a8d531e86d9caf96af83dd515f3250c3a7c9 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc
@@ -40,6 +40,10 @@ class DataUseUserDataBytes : public base::SupportsUserData::Data {
int64_t original_bytes_;
};
+// Hostname used for the other bucket which consists of chrome-services traffic.
+// This should be in sync with the same in DataReductionSiteBreakdownView.java
+const char kOtherHostName[] = "Other";
+
// static
const void* DataUseUserDataBytes::kUserDataKey =
&DataUseUserDataBytes::kUserDataKey;
@@ -84,16 +88,14 @@ void DataReductionProxyDataUseObserver::OnPageResourceLoad(
data_use_measurement::DataUse* data_use) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
- if (data_use->traffic_type() !=
- data_use_measurement::DataUse::TrafficType::USER_TRAFFIC) {
- return;
- }
-
if (!request.url().SchemeIs(url::kHttpsScheme) &&
!request.url().SchemeIs(url::kHttpScheme)) {
return;
}
+ if (request.GetTotalReceivedBytes() <= 0)
+ return;
+
int64_t network_bytes = request.GetTotalReceivedBytes();
DataReductionProxyRequestType request_type = GetDataReductionProxyRequestType(
request, data_reduction_proxy_io_data_->configurator()->GetProxyConfig(),
@@ -105,7 +107,9 @@ void DataReductionProxyDataUseObserver::OnPageResourceLoad(
request, request_type == VIA_DATA_REDUCTION_PROXY,
data_reduction_proxy_io_data_->lofi_decider());
- if (!data_use->url().is_valid()) {
+ if (data_use->traffic_type() ==
+ data_use_measurement::DataUse::TrafficType::USER_TRAFFIC &&
+ !data_use->url().is_valid()) {
// URL will be empty until pageload navigation commits. Save the data use of
// these mainframe, subresource, redirected requests in user data until
// then.
@@ -120,7 +124,11 @@ void DataReductionProxyDataUseObserver::OnPageResourceLoad(
}
} else {
data_reduction_proxy_io_data_->UpdateDataUseForHost(
- network_bytes, original_bytes, data_use->url().HostNoBrackets());
+ network_bytes, original_bytes,
+ data_use->traffic_type() ==
+ data_use_measurement::DataUse::TrafficType::USER_TRAFFIC
+ ? data_use->url().HostNoBrackets()
+ : kOtherHostName);
}
}
« no previous file with comments | « chrome/android/java/strings/android_chrome_strings.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698