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 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 29 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
30 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 30 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
31 #include "chrome/browser/net/chrome_extensions_network_delegate.h" | 31 #include "chrome/browser/net/chrome_extensions_network_delegate.h" |
32 #include "chrome/browser/net/connect_interceptor.h" | 32 #include "chrome/browser/net/connect_interceptor.h" |
33 #include "chrome/browser/net/request_source_bandwidth_histograms.h" | 33 #include "chrome/browser/net/request_source_bandwidth_histograms.h" |
34 #include "chrome/browser/net/safe_search_util.h" | 34 #include "chrome/browser/net/safe_search_util.h" |
35 #include "chrome/browser/profiles/profile_manager.h" | 35 #include "chrome/browser/profiles/profile_manager.h" |
36 #include "chrome/browser/task_manager/task_manager.h" | 36 #include "chrome/browser/task_manager/task_manager.h" |
37 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
38 #include "components/content_settings/core/browser/cookie_settings.h" | 38 #include "components/content_settings/core/browser/cookie_settings.h" |
| 39 #include "components/data_use_measurement/core/data_use_measurement.h" |
39 #include "components/domain_reliability/monitor.h" | 40 #include "components/domain_reliability/monitor.h" |
40 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
41 #include "content/public/browser/render_frame_host.h" | 42 #include "content/public/browser/render_frame_host.h" |
42 #include "content/public/browser/render_view_host.h" | 43 #include "content/public/browser/render_view_host.h" |
43 #include "content/public/browser/resource_request_info.h" | 44 #include "content/public/browser/resource_request_info.h" |
44 #include "content/public/common/content_switches.h" | 45 #include "content/public/common/content_switches.h" |
45 #include "content/public/common/process_type.h" | 46 #include "content/public/common/process_type.h" |
46 #include "net/base/host_port_pair.h" | 47 #include "net/base/host_port_pair.h" |
47 #include "net/base/load_flags.h" | 48 #include "net/base/load_flags.h" |
48 #include "net/base/net_errors.h" | 49 #include "net/base/net_errors.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 #if defined(ENABLE_TASK_MANAGER) | 481 #if defined(ENABLE_TASK_MANAGER) |
481 // This is not completely accurate, but as a first approximation ignore | 482 // This is not completely accurate, but as a first approximation ignore |
482 // requests that are served from the cache. See bug 330931 for more info. | 483 // requests that are served from the cache. See bug 330931 for more info. |
483 if (!request.was_cached()) | 484 if (!request.was_cached()) |
484 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); | 485 TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read); |
485 #endif // defined(ENABLE_TASK_MANAGER) | 486 #endif // defined(ENABLE_TASK_MANAGER) |
486 } | 487 } |
487 | 488 |
488 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, | 489 void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request, |
489 bool started) { | 490 bool started) { |
| 491 data_use_measurement_.ReportDataUseUMA(request); |
490 RecordNetworkErrorHistograms(request); | 492 RecordNetworkErrorHistograms(request); |
491 if (started) { | 493 if (started) { |
492 // Only call in for requests that were started, to obey the precondition | 494 // Only call in for requests that were started, to obey the precondition |
493 // that RecordCacheStateStats can only be called on requests for which | 495 // that RecordCacheStateStats can only be called on requests for which |
494 // OnResponseStarted was called. | 496 // OnResponseStarted was called. |
495 RecordCacheStateStats(request); | 497 RecordCacheStateStats(request); |
496 } | 498 } |
497 | 499 |
498 if (request->status().status() == net::URLRequestStatus::SUCCESS) { | 500 if (request->status().status() == net::URLRequestStatus::SUCCESS) { |
499 #if defined(OS_ANDROID) | 501 #if defined(OS_ANDROID) |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 return experimental_web_platform_features_enabled_; | 685 return experimental_web_platform_features_enabled_; |
684 } | 686 } |
685 | 687 |
686 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 688 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
687 const net::URLRequest& request, | 689 const net::URLRequest& request, |
688 const GURL& target_url, | 690 const GURL& target_url, |
689 const GURL& referrer_url) const { | 691 const GURL& referrer_url) const { |
690 ReportInvalidReferrerSend(target_url, referrer_url); | 692 ReportInvalidReferrerSend(target_url, referrer_url); |
691 return true; | 693 return true; |
692 } | 694 } |
OLD | NEW |