| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 48 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
     ig.h" | 48 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
     ig.h" | 
| 49 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data
     .h" | 49 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data
     .h" | 
| 50 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
     ata.h" | 50 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
     ata.h" | 
| 51 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_util.
     h" | 51 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_util.
     h" | 
| 52 #include "components/google/core/browser/google_util.h" | 52 #include "components/google/core/browser/google_util.h" | 
| 53 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 53 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 
| 54 #include "components/previews/core/previews_experiments.h" | 54 #include "components/previews/core/previews_experiments.h" | 
| 55 #include "components/previews/core/previews_io_data.h" | 55 #include "components/previews/core/previews_io_data.h" | 
| 56 #include "components/rappor/public/rappor_utils.h" | 56 #include "components/rappor/public/rappor_utils.h" | 
| 57 #include "components/rappor/rappor_service_impl.h" | 57 #include "components/rappor/rappor_service_impl.h" | 
|  | 58 #include "components/safe_browsing/resource_throttle.h" | 
| 58 #include "components/search_engines/template_url_service.h" | 59 #include "components/search_engines/template_url_service.h" | 
| 59 #include "components/variations/net/variations_http_headers.h" | 60 #include "components/variations/net/variations_http_headers.h" | 
| 60 #include "content/public/browser/browser_thread.h" | 61 #include "content/public/browser/browser_thread.h" | 
| 61 #include "content/public/browser/navigation_data.h" | 62 #include "content/public/browser/navigation_data.h" | 
| 62 #include "content/public/browser/notification_service.h" | 63 #include "content/public/browser/notification_service.h" | 
| 63 #include "content/public/browser/plugin_service.h" | 64 #include "content/public/browser/plugin_service.h" | 
| 64 #include "content/public/browser/plugin_service_filter.h" | 65 #include "content/public/browser/plugin_service_filter.h" | 
| 65 #include "content/public/browser/render_frame_host.h" | 66 #include "content/public/browser/render_frame_host.h" | 
| 66 #include "content/public/browser/render_process_host.h" | 67 #include "content/public/browser/render_process_host.h" | 
| 67 #include "content/public/browser/render_view_host.h" | 68 #include "content/public/browser/render_view_host.h" | 
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 644 | 645 | 
| 645 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( | 646 void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( | 
| 646     net::URLRequest* request, | 647     net::URLRequest* request, | 
| 647     content::ResourceContext* resource_context, | 648     content::ResourceContext* resource_context, | 
| 648     ResourceType resource_type, | 649     ResourceType resource_type, | 
| 649     std::vector<std::unique_ptr<content::ResourceThrottle>>* throttles) { | 650     std::vector<std::unique_ptr<content::ResourceThrottle>>* throttles) { | 
| 650   ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 651   ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 
| 651 | 652 | 
| 652   // Insert either safe browsing or data reduction proxy throttle at the front | 653   // Insert either safe browsing or data reduction proxy throttle at the front | 
| 653   // of the list, so one of them gets to decide if the resource is safe. | 654   // of the list, so one of them gets to decide if the resource is safe. | 
| 654   content::ResourceThrottle* first_throttle = NULL; | 655   std::unique_ptr<content::ResourceThrottle> first_throttle; | 
| 655 #if defined(OS_ANDROID) | 656 #if defined(OS_ANDROID) | 
| 656   first_throttle = DataReductionProxyResourceThrottle::MaybeCreate( | 657   first_throttle = | 
| 657       request, resource_context, resource_type, safe_browsing_.get()); | 658       base::WrapUnique(DataReductionProxyResourceThrottle::MaybeCreate( | 
|  | 659           request, resource_context, resource_type, safe_browsing_.get())); | 
| 658 #endif  // defined(OS_ANDROID) | 660 #endif  // defined(OS_ANDROID) | 
| 659 | 661 | 
| 660 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | 662 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | 
| 661   if (!first_throttle && io_data->safe_browsing_enabled()->GetValue()) { | 663   if (!first_throttle && io_data->safe_browsing_enabled()->GetValue()) { | 
| 662     first_throttle = SafeBrowsingResourceThrottle::MaybeCreate( | 664     first_throttle = MaybeCreateSafeBrowsingResourceThrottle( | 
| 663         request, resource_type, safe_browsing_.get()); | 665         request, resource_type, safe_browsing_.get()); | 
| 664   } | 666   } | 
| 665 #endif  // defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | 667 #endif  // defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | 
| 666 | 668 | 
| 667   if (first_throttle) | 669   if (first_throttle) | 
| 668     throttles->push_back(base::WrapUnique(first_throttle)); | 670     throttles->push_back(std::move(first_throttle)); | 
| 669 | 671 | 
| 670 #if BUILDFLAG(ENABLE_EXTENSIONS) | 672 #if BUILDFLAG(ENABLE_EXTENSIONS) | 
| 671   content::ResourceThrottle* wait_for_extensions_init_throttle = | 673   content::ResourceThrottle* wait_for_extensions_init_throttle = | 
| 672       user_script_listener_->CreateResourceThrottle(request->url(), | 674       user_script_listener_->CreateResourceThrottle(request->url(), | 
| 673                                                     resource_type); | 675                                                     resource_type); | 
| 674   if (wait_for_extensions_init_throttle) | 676   if (wait_for_extensions_init_throttle) | 
| 675     throttles->push_back(base::WrapUnique(wait_for_extensions_init_throttle)); | 677     throttles->push_back(base::WrapUnique(wait_for_extensions_init_throttle)); | 
| 676 | 678 | 
| 677   extensions::ExtensionThrottleManager* extension_throttle_manager = | 679   extensions::ExtensionThrottleManager* extension_throttle_manager = | 
| 678       io_data->GetExtensionThrottleManager(); | 680       io_data->GetExtensionThrottleManager(); | 
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 965             &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 967             &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 
| 966             base::Unretained(this), url, request_loading_time)); | 968             base::Unretained(this), url, request_loading_time)); | 
| 967     return; | 969     return; | 
| 968   } | 970   } | 
| 969 | 971 | 
| 970   std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 972   std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 
| 971       "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 973       "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 
| 972   rappor::SampleDomainAndRegistryFromGURL( | 974   rappor::SampleDomainAndRegistryFromGURL( | 
| 973       g_browser_process->rappor_service(), metric_name, url); | 975       g_browser_process->rappor_service(), metric_name, url); | 
| 974 } | 976 } | 
| OLD | NEW | 
|---|