| 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/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/plugins/plugin_prefs.h" | 27 #include "chrome/browser/plugins/plugin_prefs.h" |
| 28 #include "chrome/browser/prerender/prerender_manager.h" | 28 #include "chrome/browser/prerender/prerender_manager.h" |
| 29 #include "chrome/browser/prerender/prerender_manager_factory.h" | 29 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 30 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 30 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
| 31 #include "chrome/browser/prerender/prerender_util.h" | 31 #include "chrome/browser/prerender/prerender_util.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/profiles/profile_io_data.h" | 33 #include "chrome/browser/profiles/profile_io_data.h" |
| 34 #include "chrome/browser/renderer_host/chrome_navigation_data.h" | 34 #include "chrome/browser/renderer_host/chrome_navigation_data.h" |
| 35 #include "chrome/browser/renderer_host/predictor_resource_throttle.h" | 35 #include "chrome/browser/renderer_host/predictor_resource_throttle.h" |
| 36 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 36 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 37 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" | |
| 38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 37 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 39 #include "chrome/browser/search/search.h" | 38 #include "chrome/browser/search/search.h" |
| 40 #include "chrome/browser/search_engines/template_url_service_factory.h" | 39 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 41 #include "chrome/browser/signin/chrome_signin_helper.h" | 40 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 42 #include "chrome/browser/tab_contents/tab_util.h" | 41 #include "chrome/browser/tab_contents/tab_util.h" |
| 43 #include "chrome/browser/ui/login/login_handler.h" | 42 #include "chrome/browser/ui/login/login_handler.h" |
| 44 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/features.h" | 44 #include "chrome/common/features.h" |
| 46 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
| 47 #include "components/content_settings/core/browser/host_content_settings_map.h" | 46 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (extension_throttle) | 638 if (extension_throttle) |
| 640 throttles->push_back(extension_throttle.release()); | 639 throttles->push_back(extension_throttle.release()); |
| 641 } | 640 } |
| 642 #endif | 641 #endif |
| 643 | 642 |
| 644 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 643 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 645 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { | 644 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { |
| 646 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); | 645 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); |
| 647 } | 646 } |
| 648 | 647 |
| 649 if (ThreadHopResourceThrottle::IsEnabled()) | |
| 650 throttles->push_back(new ThreadHopResourceThrottle); | |
| 651 | |
| 652 std::unique_ptr<PredictorResourceThrottle> predictor_throttle = | 648 std::unique_ptr<PredictorResourceThrottle> predictor_throttle = |
| 653 PredictorResourceThrottle::MaybeCreate(request, io_data); | 649 PredictorResourceThrottle::MaybeCreate(request, io_data); |
| 654 if (predictor_throttle) | 650 if (predictor_throttle) |
| 655 throttles->push_back(predictor_throttle.release()); | 651 throttles->push_back(predictor_throttle.release()); |
| 656 } | 652 } |
| 657 | 653 |
| 658 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( | 654 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( |
| 659 const GURL& url, const std::string& mime_type) { | 655 const GURL& url, const std::string& mime_type) { |
| 660 #if defined(ENABLE_EXTENSIONS) | 656 #if defined(ENABLE_EXTENSIONS) |
| 661 // Special-case user scripts to get downloaded instead of viewed. | 657 // Special-case user scripts to get downloaded instead of viewed. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 886 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 891 base::Unretained(this), url, request_loading_time)); | 887 base::Unretained(this), url, request_loading_time)); |
| 892 return; | 888 return; |
| 893 } | 889 } |
| 894 | 890 |
| 895 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 891 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 896 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 892 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 897 rappor::SampleDomainAndRegistryFromGURL( | 893 rappor::SampleDomainAndRegistryFromGURL( |
| 898 g_browser_process->rappor_service(), metric_name, url); | 894 g_browser_process->rappor_service(), metric_name, url); |
| 899 } | 895 } |
| OLD | NEW |