| OLD | NEW |
| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 if (domain_reliability_monitor_) | 471 if (domain_reliability_monitor_) |
| 472 domain_reliability_monitor_->OnBeforeRedirect(request); | 472 domain_reliability_monitor_->OnBeforeRedirect(request); |
| 473 extensions_delegate_->OnBeforeRedirect(request, new_location); | 473 extensions_delegate_->OnBeforeRedirect(request, new_location); |
| 474 } | 474 } |
| 475 | 475 |
| 476 | 476 |
| 477 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { | 477 void ChromeNetworkDelegate::OnResponseStarted(net::URLRequest* request) { |
| 478 extensions_delegate_->OnResponseStarted(request); | 478 extensions_delegate_->OnResponseStarted(request); |
| 479 } | 479 } |
| 480 | 480 |
| 481 void ChromeNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, | 481 void ChromeNetworkDelegate::OnNetworkBytesReceived( |
| 482 int bytes_read) { | 482 const net::URLRequest& request, |
| 483 int64_t bytes_received) { |
| 483 #if defined(ENABLE_TASK_MANAGER) | 484 #if defined(ENABLE_TASK_MANAGER) |
| 484 // This is not completely accurate, but as a first approximation ignore | 485 // Note: Currently, OnNetworkBytesReceived is only implemented for HTTP jobs, |
| 485 // requests that are served from the cache. See bug 330931 for more info. | 486 // not FTP or other types, so those kinds of bytes will not be reported here. |
| 486 if (!request.was_cached()) { | 487 task_management::TaskManagerInterface::OnRawBytesRead(request, |
| 487 task_management::TaskManagerInterface::OnRawBytesRead(request, bytes_read); | 488 bytes_received); |
| 488 } | |
| 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 RecordNetworkErrorHistograms(request); | 494 RecordNetworkErrorHistograms(request); |
| 495 if (started) { | 495 if (started) { |
| 496 // Only call in for requests that were started, to obey the precondition | 496 // Only call in for requests that were started, to obey the precondition |
| 497 // that RecordCacheStateStats can only be called on requests for which | 497 // that RecordCacheStateStats can only be called on requests for which |
| 498 // OnResponseStarted was called. | 498 // OnResponseStarted was called. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 return experimental_web_platform_features_enabled_; | 689 return experimental_web_platform_features_enabled_; |
| 690 } | 690 } |
| 691 | 691 |
| 692 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 692 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 693 const net::URLRequest& request, | 693 const net::URLRequest& request, |
| 694 const GURL& target_url, | 694 const GURL& target_url, |
| 695 const GURL& referrer_url) const { | 695 const GURL& referrer_url) const { |
| 696 ReportInvalidReferrerSend(target_url, referrer_url); | 696 ReportInvalidReferrerSend(target_url, referrer_url); |
| 697 return true; | 697 return true; |
| 698 } | 698 } |
| OLD | NEW |