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/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 13 matching lines...) Expand all Loading... | |
| 24 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" | 24 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" |
| 25 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 25 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 26 #include "chrome/browser/plugins/plugin_prefs.h" | 26 #include "chrome/browser/plugins/plugin_prefs.h" |
| 27 #include "chrome/browser/prerender/prerender_manager.h" | 27 #include "chrome/browser/prerender/prerender_manager.h" |
| 28 #include "chrome/browser/prerender/prerender_manager_factory.h" | 28 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 29 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 29 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
| 30 #include "chrome/browser/prerender/prerender_util.h" | 30 #include "chrome/browser/prerender/prerender_util.h" |
| 31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 32 #include "chrome/browser/profiles/profile_io_data.h" | 32 #include "chrome/browser/profiles/profile_io_data.h" |
| 33 #include "chrome/browser/renderer_host/chrome_navigation_data.h" | 33 #include "chrome/browser/renderer_host/chrome_navigation_data.h" |
| 34 #include "chrome/browser/renderer_host/predictor_resource_throttle.h" | |
| 34 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 35 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 35 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" | 36 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" |
| 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 37 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 37 #include "chrome/browser/search/search.h" | 38 #include "chrome/browser/search/search.h" |
| 38 #include "chrome/browser/search_engines/template_url_service_factory.h" | 39 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 39 #include "chrome/browser/signin/chrome_signin_helper.h" | 40 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 40 #include "chrome/browser/tab_contents/tab_util.h" | 41 #include "chrome/browser/tab_contents/tab_util.h" |
| 41 #include "chrome/browser/ui/login/login_handler.h" | 42 #include "chrome/browser/ui/login/login_handler.h" |
| 42 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 43 #include "chrome/common/features.h" | 44 #include "chrome/common/features.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 } | 589 } |
| 589 #endif | 590 #endif |
| 590 | 591 |
| 591 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 592 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 592 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { | 593 if (info->GetVisibilityState() == blink::WebPageVisibilityStatePrerender) { |
| 593 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); | 594 throttles->push_back(new prerender::PrerenderResourceThrottle(request)); |
| 594 } | 595 } |
| 595 | 596 |
| 596 if (ThreadHopResourceThrottle::IsEnabled()) | 597 if (ThreadHopResourceThrottle::IsEnabled()) |
| 597 throttles->push_back(new ThreadHopResourceThrottle); | 598 throttles->push_back(new ThreadHopResourceThrottle); |
| 599 | |
| 600 if (io_data->GetPredictor()) { | |
|
mmenke
2016/05/23 18:50:22
I'd suggest avoiding the knowledge that we only cr
Charlie Harrison
2016/05/23 21:13:32
SGTM. Done.
| |
| 601 throttles->push_back( | |
| 602 new PredictorResourceThrottle(request, io_data->GetPredictor())); | |
| 603 } | |
| 598 } | 604 } |
| 599 | 605 |
| 600 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( | 606 bool ChromeResourceDispatcherHostDelegate::ShouldForceDownloadResource( |
| 601 const GURL& url, const std::string& mime_type) { | 607 const GURL& url, const std::string& mime_type) { |
| 602 #if defined(ENABLE_EXTENSIONS) | 608 #if defined(ENABLE_EXTENSIONS) |
| 603 // Special-case user scripts to get downloaded instead of viewed. | 609 // Special-case user scripts to get downloaded instead of viewed. |
| 604 return extensions::UserScript::IsURLUserScript(url, mime_type); | 610 return extensions::UserScript::IsURLUserScript(url, mime_type); |
| 605 #else | 611 #else |
| 606 return false; | 612 return false; |
| 607 #endif | 613 #endif |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data = | 820 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data = |
| 815 data_reduction_proxy::DataReductionProxyData::GetData(*request); | 821 data_reduction_proxy::DataReductionProxyData::GetData(*request); |
| 816 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the | 822 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the |
| 817 // URLRequest and DataReductionProxyData from both having ownership of the | 823 // URLRequest and DataReductionProxyData from both having ownership of the |
| 818 // same object. This copy will be shortlived as it will be deep copied again | 824 // same object. This copy will be shortlived as it will be deep copied again |
| 819 // when content makes a clone of NavigationData for the UI thread. | 825 // when content makes a clone of NavigationData for the UI thread. |
| 820 if (data_reduction_proxy_data) | 826 if (data_reduction_proxy_data) |
| 821 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); | 827 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); |
| 822 return data; | 828 return data; |
| 823 } | 829 } |
| OLD | NEW |