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 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/download/download_resource_throttle.h" | 22 #include "chrome/browser/download/download_resource_throttle.h" |
| 23 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" | 23 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" |
| 24 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 24 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 25 #include "chrome/browser/plugins/plugin_prefs.h" | 25 #include "chrome/browser/plugins/plugin_prefs.h" |
| 26 #include "chrome/browser/prerender/prerender_manager.h" | 26 #include "chrome/browser/prerender/prerender_manager.h" |
| 27 #include "chrome/browser/prerender/prerender_manager_factory.h" | 27 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 28 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 28 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
| 29 #include "chrome/browser/prerender/prerender_util.h" | 29 #include "chrome/browser/prerender/prerender_util.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/profiles/profile_io_data.h" | 31 #include "chrome/browser/profiles/profile_io_data.h" |
| 32 #include "chrome/browser/renderer_host/chrome_navigation_data.h" | |
| 32 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 33 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 33 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" | 34 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" |
| 34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 35 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 35 #include "chrome/browser/signin/chrome_signin_helper.h" | 36 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 36 #include "chrome/browser/tab_contents/tab_util.h" | 37 #include "chrome/browser/tab_contents/tab_util.h" |
| 37 #include "chrome/browser/ui/login/login_handler.h" | 38 #include "chrome/browser/ui/login/login_handler.h" |
| 38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/features.h" | 40 #include "chrome/common/features.h" |
| 40 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
| 41 #include "components/content_settings/core/browser/host_content_settings_map.h" | 42 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 43 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data .h" | |
| 42 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" | 44 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" |
| 43 #include "components/google/core/browser/google_util.h" | 45 #include "components/google/core/browser/google_util.h" |
| 44 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 46 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
| 45 #include "components/variations/net/variations_http_headers.h" | 47 #include "components/variations/net/variations_http_headers.h" |
| 46 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
| 49 #include "content/public/browser/navigation_data.h" | |
| 47 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
| 48 #include "content/public/browser/plugin_service.h" | 51 #include "content/public/browser/plugin_service.h" |
| 49 #include "content/public/browser/plugin_service_filter.h" | 52 #include "content/public/browser/plugin_service_filter.h" |
| 50 #include "content/public/browser/render_process_host.h" | 53 #include "content/public/browser/render_process_host.h" |
| 51 #include "content/public/browser/render_view_host.h" | 54 #include "content/public/browser/render_view_host.h" |
| 52 #include "content/public/browser/resource_context.h" | 55 #include "content/public/browser/resource_context.h" |
| 53 #include "content/public/browser/resource_dispatcher_host.h" | 56 #include "content/public/browser/resource_dispatcher_host.h" |
| 54 #include "content/public/browser/resource_request_info.h" | 57 #include "content/public/browser/resource_request_info.h" |
| 55 #include "content/public/browser/service_worker_context.h" | 58 #include "content/public/browser/service_worker_context.h" |
| 56 #include "content/public/browser/stream_info.h" | 59 #include "content/public/browser/stream_info.h" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 715 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); | 718 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); |
| 716 return false; | 719 return false; |
| 717 } | 720 } |
| 718 | 721 |
| 719 // static | 722 // static |
| 720 void ChromeResourceDispatcherHostDelegate:: | 723 void ChromeResourceDispatcherHostDelegate:: |
| 721 SetExternalProtocolHandlerDelegateForTesting( | 724 SetExternalProtocolHandlerDelegateForTesting( |
| 722 ExternalProtocolHandler::Delegate* delegate) { | 725 ExternalProtocolHandler::Delegate* delegate) { |
| 723 g_external_protocol_handler_delegate = delegate; | 726 g_external_protocol_handler_delegate = delegate; |
| 724 } | 727 } |
| 728 | |
| 729 std::unique_ptr<content::NavigationData> | |
| 730 ChromeResourceDispatcherHostDelegate::GetNavigationData( | |
| 731 net::URLRequest* request) const { | |
| 732 std::unique_ptr<ChromeNavigationData> data(new ChromeNavigationData()); | |
| 733 // Get the existing Data instance off of URLRequest. | |
|
bengr
2016/04/29 21:14:20
Delete this comment.
RyanSturm
2016/05/02 19:52:19
Done.
| |
| 734 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data = | |
| 735 data_reduction_proxy::DataReductionProxyData::DataForRequest(request, | |
|
bengr
2016/04/29 21:14:20
Maybe the reason you felt compelled to add a comme
RyanSturm
2016/05/02 19:52:19
Done.
| |
| 736 false); | |
|
bengr
2016/04/29 21:14:20
This second parameter is probably the cleaner way
RyanSturm
2016/05/02 19:52:19
Because of the difference in const-ness of the URL
| |
| 737 // DeepCopy the DataReductionProxyData from the URLRequest to prevent the | |
| 738 // URLRequest and DataReductionProxyData from both having ownership of the | |
| 739 // same object. This copy will be shortlived as it will be DeepCopy'd again | |
|
bengr
2016/04/29 21:14:20
DeepCopy'd -> deep copied
RyanSturm
2016/05/02 19:52:19
Done.
| |
| 740 // when content makes a clone of NavigationData for the UI thread. | |
|
bengr
2016/04/29 21:14:20
You should make a note somewhere (probably on the
RyanSturm
2016/05/02 19:52:19
Done.
| |
| 741 if (data_reduction_proxy_data) | |
| 742 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); | |
| 743 return std::move(data); | |
| 744 } | |
| OLD | NEW |