Chromium Code Reviews| 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/loader/chrome_resource_dispatcher_host_delegate.h" | 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" | 99 #include "chrome/browser/supervised_user/supervised_user_resource_throttle.h" |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 #if defined(USE_SYSTEM_PROTOBUF) | 102 #if defined(USE_SYSTEM_PROTOBUF) |
| 103 #include <google/protobuf/repeated_field.h> | 103 #include <google/protobuf/repeated_field.h> |
| 104 #else | 104 #else |
| 105 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 105 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
| 106 #endif | 106 #endif |
| 107 | 107 |
| 108 #if defined(OS_ANDROID) | 108 #if defined(OS_ANDROID) |
| 109 #include "chrome/browser/android/download/intercept_download_resource_throttle.h " | |
| 109 #include "chrome/browser/android/offline_pages/downloads/resource_throttle.h" | 110 #include "chrome/browser/android/offline_pages/downloads/resource_throttle.h" |
| 110 #include "chrome/browser/loader/data_reduction_proxy_resource_throttle_android.h " | 111 #include "chrome/browser/loader/data_reduction_proxy_resource_throttle_android.h " |
| 111 #include "components/navigation_interception/intercept_navigation_delegate.h" | 112 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 112 #endif | 113 #endif |
| 113 | 114 |
| 114 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
| 115 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h " | 116 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h " |
| 116 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" | 117 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
| 117 #endif | 118 #endif |
| 118 | 119 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 BrowserThread::PostTask( | 536 BrowserThread::PostTask( |
| 536 BrowserThread::UI, FROM_HERE, | 537 BrowserThread::UI, FROM_HERE, |
| 537 base::Bind(&NotifyDownloadInitiatedOnUI, | 538 base::Bind(&NotifyDownloadInitiatedOnUI, |
| 538 info->GetWebContentsGetterForRequest())); | 539 info->GetWebContentsGetterForRequest())); |
| 539 | 540 |
| 540 // If it's from the web, we don't trust it, so we push the throttle on. | 541 // If it's from the web, we don't trust it, so we push the throttle on. |
| 541 if (is_content_initiated) { | 542 if (is_content_initiated) { |
| 542 throttles->push_back(base::MakeUnique<DownloadResourceThrottle>( | 543 throttles->push_back(base::MakeUnique<DownloadResourceThrottle>( |
| 543 download_request_limiter_, info->GetWebContentsGetterForRequest(), | 544 download_request_limiter_, info->GetWebContentsGetterForRequest(), |
| 544 request->url(), request->method())); | 545 request->url(), request->method())); |
| 546 #if defined(OS_ANDROID) | |
| 547 throttles->push_back( | |
| 548 base::MakeUnique<InterceptDownloadResourceThrottle>( | |
| 549 request, info->GetWebContentsGetterForRequest())); | |
| 550 #endif | |
|
asanka
2017/01/19 23:59:13
This is the wrong place to add this resource throt
qinmin
2017/01/20 00:06:10
Done.
| |
| 545 } | 551 } |
| 546 | 552 |
| 547 // If this isn't a new request, the standard resource throttles have already | 553 // If this isn't a new request, the standard resource throttles have already |
| 548 // been added, so no need to add them again. | 554 // been added, so no need to add them again. |
| 549 if (is_new_request) { | 555 if (is_new_request) { |
| 550 AppendStandardResourceThrottles(request, | 556 AppendStandardResourceThrottles(request, |
| 551 resource_context, | 557 resource_context, |
| 552 content::RESOURCE_TYPE_MAIN_FRAME, | 558 content::RESOURCE_TYPE_MAIN_FRAME, |
| 553 throttles); | 559 throttles); |
| 554 #if defined(OS_ANDROID) | 560 #if defined(OS_ANDROID) |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 915 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 921 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 916 base::Unretained(this), url, request_loading_time)); | 922 base::Unretained(this), url, request_loading_time)); |
| 917 return; | 923 return; |
| 918 } | 924 } |
| 919 | 925 |
| 920 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 926 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 921 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 927 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 922 rappor::SampleDomainAndRegistryFromGURL( | 928 rappor::SampleDomainAndRegistryFromGURL( |
| 923 g_browser_process->rappor_service(), metric_name, url); | 929 g_browser_process->rappor_service(), metric_name, url); |
| 924 } | 930 } |
| OLD | NEW |