| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #include <google/protobuf/repeated_field.h> | 100 #include <google/protobuf/repeated_field.h> |
| 101 #else | 101 #else |
| 102 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 102 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 #if defined(OS_ANDROID) | 105 #if defined(OS_ANDROID) |
| 106 #include "chrome/browser/loader/data_reduction_proxy_resource_throttle_android.h
" | 106 #include "chrome/browser/loader/data_reduction_proxy_resource_throttle_android.h
" |
| 107 #include "components/navigation_interception/intercept_navigation_delegate.h" | 107 #include "components/navigation_interception/intercept_navigation_delegate.h" |
| 108 #endif | 108 #endif |
| 109 | 109 |
| 110 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 111 #include "chrome/browser/android/offline_pages/downloads/resource_throttle.h" |
| 112 #endif |
| 113 |
| 110 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
| 111 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h
" | 115 #include "chrome/browser/chromeos/login/signin/merge_session_resource_throttle.h
" |
| 112 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" | 116 #include "chrome/browser/chromeos/login/signin/merge_session_throttling_utils.h" |
| 113 #endif | 117 #endif |
| 114 | 118 |
| 115 using content::BrowserThread; | 119 using content::BrowserThread; |
| 116 using content::RenderViewHost; | 120 using content::RenderViewHost; |
| 117 using content::ResourceDispatcherHostLoginDelegate; | 121 using content::ResourceDispatcherHostLoginDelegate; |
| 118 using content::ResourceRequestInfo; | 122 using content::ResourceRequestInfo; |
| 119 using content::ResourceType; | 123 using content::ResourceType; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 request->url(), request->method())); | 538 request->url(), request->method())); |
| 535 } | 539 } |
| 536 | 540 |
| 537 // If this isn't a new request, the standard resource throttles have already | 541 // If this isn't a new request, the standard resource throttles have already |
| 538 // been added, so no need to add them again. | 542 // been added, so no need to add them again. |
| 539 if (is_new_request) { | 543 if (is_new_request) { |
| 540 AppendStandardResourceThrottles(request, | 544 AppendStandardResourceThrottles(request, |
| 541 resource_context, | 545 resource_context, |
| 542 content::RESOURCE_TYPE_MAIN_FRAME, | 546 content::RESOURCE_TYPE_MAIN_FRAME, |
| 543 throttles); | 547 throttles); |
| 548 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 549 // On Android, forward text/html downloads to OfflinePages backend. |
| 550 throttles->push_back( |
| 551 new offline_pages::downloads::ResourceThrottle(request)); |
| 552 #endif |
| 544 } | 553 } |
| 545 } | 554 } |
| 546 | 555 |
| 547 ResourceDispatcherHostLoginDelegate* | 556 ResourceDispatcherHostLoginDelegate* |
| 548 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( | 557 ChromeResourceDispatcherHostDelegate::CreateLoginDelegate( |
| 549 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { | 558 net::AuthChallengeInfo* auth_info, net::URLRequest* request) { |
| 550 return CreateLoginPrompt(auth_info, request); | 559 return CreateLoginPrompt(auth_info, request); |
| 551 } | 560 } |
| 552 | 561 |
| 553 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( | 562 bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 892 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 884 base::Unretained(this), url, request_loading_time)); | 893 base::Unretained(this), url, request_loading_time)); |
| 885 return; | 894 return; |
| 886 } | 895 } |
| 887 | 896 |
| 888 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 897 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 889 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 898 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 890 rappor::SampleDomainAndRegistryFromGURL( | 899 rappor::SampleDomainAndRegistryFromGURL( |
| 891 g_browser_process->rappor_service(), metric_name, url); | 900 g_browser_process->rappor_service(), metric_name, url); |
| 892 } | 901 } |
| OLD | NEW |