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 12 matching lines...) Expand all Loading... | |
23 #include "base/profiler/scoped_tracker.h" | 23 #include "base/profiler/scoped_tracker.h" |
24 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
26 #include "base/time/time.h" | 26 #include "base/time/time.h" |
27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
28 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 28 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
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/data_use_measurement.h" | |
33 #include "chrome/browser/net/request_source_bandwidth_histograms.h" | 34 #include "chrome/browser/net/request_source_bandwidth_histograms.h" |
34 #include "chrome/browser/net/safe_search_util.h" | 35 #include "chrome/browser/net/safe_search_util.h" |
35 #include "chrome/browser/profiles/profile_manager.h" | 36 #include "chrome/browser/profiles/profile_manager.h" |
36 #include "chrome/browser/task_manager/task_manager.h" | 37 #include "chrome/browser/task_manager/task_manager.h" |
37 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
38 #include "components/content_settings/core/browser/cookie_settings.h" | 39 #include "components/content_settings/core/browser/cookie_settings.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" |
(...skipping 437 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 // We have assumed that all the request for user contents and for services | |
bengr
2015/08/07 18:00:00
Don't personify code. Also, don't assume. How abou
amohammadkhan
2015/08/11 22:04:34
Done.
| |
492 // are passing this path. So we record All the data use here and later in | |
493 // ReportDataUsage function, ALL traffic is divided to two sub-categories of | |
494 // USER_DATA and NOT_USER_DATA. Notice to the fact that detailed usage | |
495 // statistics of services is not gathered here and it is recorded in | |
496 // OnURLFetchComplete function of those services. | |
497 ReportDataUsage(request); | |
498 | |
490 RecordNetworkErrorHistograms(request); | 499 RecordNetworkErrorHistograms(request); |
491 if (started) { | 500 if (started) { |
492 // Only call in for requests that were started, to obey the precondition | 501 // Only call in for requests that were started, to obey the precondition |
493 // that RecordCacheStateStats can only be called on requests for which | 502 // that RecordCacheStateStats can only be called on requests for which |
494 // OnResponseStarted was called. | 503 // OnResponseStarted was called. |
495 RecordCacheStateStats(request); | 504 RecordCacheStateStats(request); |
496 } | 505 } |
497 | 506 |
498 if (request->status().status() == net::URLRequestStatus::SUCCESS) { | 507 if (request->status().status() == net::URLRequestStatus::SUCCESS) { |
499 #if defined(OS_ANDROID) | 508 #if defined(OS_ANDROID) |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 return experimental_web_platform_features_enabled_; | 692 return experimental_web_platform_features_enabled_; |
684 } | 693 } |
685 | 694 |
686 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 695 bool ChromeNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
687 const net::URLRequest& request, | 696 const net::URLRequest& request, |
688 const GURL& target_url, | 697 const GURL& target_url, |
689 const GURL& referrer_url) const { | 698 const GURL& referrer_url) const { |
690 ReportInvalidReferrerSend(target_url, referrer_url); | 699 ReportInvalidReferrerSend(target_url, referrer_url); |
691 return true; | 700 return true; |
692 } | 701 } |
OLD | NEW |