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

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

Issue 1279543002: Support needed to measure user and service traffic in Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewHistogram
Patch Set: Addressing reviewers' comments. Created 5 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 <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 #if defined(ENABLE_TASK_MANAGER) 484 #if defined(ENABLE_TASK_MANAGER)
485 // Note: Currently, OnNetworkBytesReceived is only implemented for HTTP jobs, 485 // Note: Currently, OnNetworkBytesReceived is only implemented for HTTP jobs,
486 // not FTP or other types, so those kinds of bytes will not be reported here. 486 // not FTP or other types, so those kinds of bytes will not be reported here.
487 task_management::TaskManagerInterface::OnRawBytesRead(request, 487 task_management::TaskManagerInterface::OnRawBytesRead(request,
488 bytes_received); 488 bytes_received);
489 #endif // defined(ENABLE_TASK_MANAGER) 489 #endif // defined(ENABLE_TASK_MANAGER)
490 } 490 }
491 491
492 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, 492 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request,
493 bool started) { 493 bool started) {
494 #if !defined(OS_IOS)
495 // TODO(amohammadkhan): Reporting should be done on redirects too. Because
496 // following a redirect resets the received/sent bytes. Though if the request
497 // is cancelled instead of following the redirect, it will end up here, and
498 // the data will be double counted.
499 data_use_measurement_.ReportDataUseUMA(request);
mmenke 2015/09/03 16:02:58 Think first pass, you should measure usage for red
amohammadkhan 2015/09/03 23:10:36 Sorry I think I didn't understand what you meant f
500 #endif
494 RecordNetworkErrorHistograms(request); 501 RecordNetworkErrorHistograms(request);
495 if (started) { 502 if (started) {
496 // Only call in for requests that were started, to obey the precondition 503 // Only call in for requests that were started, to obey the precondition
497 // that RecordCacheStateStats can only be called on requests for which 504 // that RecordCacheStateStats can only be called on requests for which
498 // OnResponseStarted was called. 505 // OnResponseStarted was called.
499 RecordCacheStateStats(request); 506 RecordCacheStateStats(request);
500 } 507 }
501 508
502 if (request->status().status() == net::URLRequestStatus::SUCCESS) { 509 if (request->status().status() == net::URLRequestStatus::SUCCESS) {
503 #if defined(OS_ANDROID) 510 #if defined(OS_ANDROID)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 return experimental_web_platform_features_enabled_; 696 return experimental_web_platform_features_enabled_;
690 } 697 }
691 698
692 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( 699 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
693 const net::URLRequest& request, 700 const net::URLRequest& request,
694 const GURL& target_url, 701 const GURL& target_url,
695 const GURL& referrer_url) const { 702 const GURL& referrer_url) const {
696 ReportInvalidReferrerSend(target_url, referrer_url); 703 ReportInvalidReferrerSend(target_url, referrer_url);
697 return true; 704 return true;
698 } 705 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698