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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 2358663004: Fix foregound vs background data use measurement (Closed)
Patch Set: Addressed bengr comments 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 int ChromeNetworkDelegate::OnBeforeURLRequest( 232 int ChromeNetworkDelegate::OnBeforeURLRequest(
233 net::URLRequest* request, 233 net::URLRequest* request,
234 const net::CompletionCallback& callback, 234 const net::CompletionCallback& callback,
235 GURL* new_url) { 235 GURL* new_url) {
236 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed. 236 // TODO(mmenke): Remove ScopedTracker below once crbug.com/456327 is fixed.
237 tracked_objects::ScopedTracker tracking_profile1( 237 tracked_objects::ScopedTracker tracking_profile1(
238 FROM_HERE_WITH_EXPLICIT_FUNCTION( 238 FROM_HERE_WITH_EXPLICIT_FUNCTION(
239 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest")); 239 "456327 URLRequest::ChromeNetworkDelegate::OnBeforeURLRequest"));
240 240
241 data_use_measurement_.OnBeforeURLRequest(request);
242
241 // TODO(joaodasilva): This prevents extensions from seeing URLs that are 243 // TODO(joaodasilva): This prevents extensions from seeing URLs that are
242 // blocked. However, an extension might redirect the request to another URL, 244 // blocked. However, an extension might redirect the request to another URL,
243 // which is not blocked. 245 // which is not blocked.
244 246
245 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 247 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
246 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR; 248 int error = net::ERR_BLOCKED_BY_ADMINISTRATOR;
247 if (info && content::IsResourceTypeFrame(info->GetResourceType()) && 249 if (info && content::IsResourceTypeFrame(info->GetResourceType()) &&
248 url_blacklist_manager_ && 250 url_blacklist_manager_ &&
249 url_blacklist_manager_->ShouldBlockRequestForFrame( 251 url_blacklist_manager_->ShouldBlockRequestForFrame(
250 request->url(), &error)) { 252 request->url(), &error)) {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 if (!data_use_aggregator_) 589 if (!data_use_aggregator_)
588 return; 590 return;
589 591
590 if (is_data_usage_off_the_record_) { 592 if (is_data_usage_off_the_record_) {
591 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes); 593 data_use_aggregator_->ReportOffTheRecordDataUse(tx_bytes, rx_bytes);
592 return; 594 return;
593 } 595 }
594 596
595 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes); 597 data_use_aggregator_->ReportDataUse(request, tx_bytes, rx_bytes);
596 } 598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698