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> |
| 11 | 11 |
| 12 #include "base/base64.h" | 12 #include "base/base64.h" |
| 13 #include "base/guid.h" | 13 #include "base/guid.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/ptr_util.h" | |
| 15 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/component_updater/component_updater_resource_throttle.h " | 21 #include "chrome/browser/component_updater/component_updater_resource_throttle.h " |
| 21 #include "chrome/browser/download/download_request_limiter.h" | 22 #include "chrome/browser/download/download_request_limiter.h" |
| 22 #include "chrome/browser/download/download_resource_throttle.h" | 23 #include "chrome/browser/download/download_resource_throttle.h" |
| 23 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" | 24 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" |
| 24 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 25 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 25 #include "chrome/browser/plugins/plugin_prefs.h" | 26 #include "chrome/browser/plugins/plugin_prefs.h" |
| 26 #include "chrome/browser/prerender/prerender_manager.h" | 27 #include "chrome/browser/prerender/prerender_manager.h" |
| 27 #include "chrome/browser/prerender/prerender_manager_factory.h" | 28 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 28 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 29 #include "chrome/browser/prerender/prerender_resource_throttle.h" |
| 29 #include "chrome/browser/prerender/prerender_util.h" | 30 #include "chrome/browser/prerender/prerender_util.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 31 #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" | |
| 32 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" | 34 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" |
| 33 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" | 35 #include "chrome/browser/renderer_host/thread_hop_resource_throttle.h" |
| 34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 35 #include "chrome/browser/signin/chrome_signin_helper.h" | 37 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 36 #include "chrome/browser/tab_contents/tab_util.h" | 38 #include "chrome/browser/tab_contents/tab_util.h" |
| 37 #include "chrome/browser/ui/login/login_handler.h" | 39 #include "chrome/browser/ui/login/login_handler.h" |
| 38 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/features.h" | 41 #include "chrome/common/features.h" |
| 40 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 41 #include "components/content_settings/core/browser/host_content_settings_map.h" | 43 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 44 #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" | 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" |
| 43 #include "components/google/core/browser/google_util.h" | 46 #include "components/google/core/browser/google_util.h" |
| 44 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 47 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
| 45 #include "components/variations/net/variations_http_headers.h" | 48 #include "components/variations/net/variations_http_headers.h" |
| 46 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
| 50 #include "content/public/browser/navigation_data.h" | |
| 47 #include "content/public/browser/notification_service.h" | 51 #include "content/public/browser/notification_service.h" |
| 48 #include "content/public/browser/plugin_service.h" | 52 #include "content/public/browser/plugin_service.h" |
| 49 #include "content/public/browser/plugin_service_filter.h" | 53 #include "content/public/browser/plugin_service_filter.h" |
| 50 #include "content/public/browser/render_process_host.h" | 54 #include "content/public/browser/render_process_host.h" |
| 51 #include "content/public/browser/render_view_host.h" | 55 #include "content/public/browser/render_view_host.h" |
| 52 #include "content/public/browser/resource_context.h" | 56 #include "content/public/browser/resource_context.h" |
| 53 #include "content/public/browser/resource_dispatcher_host.h" | 57 #include "content/public/browser/resource_dispatcher_host.h" |
| 54 #include "content/public/browser/resource_request_info.h" | 58 #include "content/public/browser/resource_request_info.h" |
| 55 #include "content/public/browser/service_worker_context.h" | 59 #include "content/public/browser/service_worker_context.h" |
| 56 #include "content/public/browser/stream_info.h" | 60 #include "content/public/browser/stream_info.h" |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 714 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); | 718 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); |
| 715 return false; | 719 return false; |
| 716 } | 720 } |
| 717 | 721 |
| 718 // static | 722 // static |
| 719 void ChromeResourceDispatcherHostDelegate:: | 723 void ChromeResourceDispatcherHostDelegate:: |
| 720 SetExternalProtocolHandlerDelegateForTesting( | 724 SetExternalProtocolHandlerDelegateForTesting( |
| 721 ExternalProtocolHandler::Delegate* delegate) { | 725 ExternalProtocolHandler::Delegate* delegate) { |
| 722 g_external_protocol_handler_delegate = delegate; | 726 g_external_protocol_handler_delegate = delegate; |
| 723 } | 727 } |
| 728 | |
| 729 std::unique_ptr<content::NavigationData> | |
| 730 ChromeResourceDispatcherHostDelegate::GetNavigationData( | |
| 731 net::URLRequest* request) const { | |
| 732 ChromeNavigationData* data = new ChromeNavigationData(); | |
|
nasko
2016/04/26 20:18:39
Use unique_ptr.
RyanSturm
2016/04/27 23:27:46
Done.
| |
| 733 // Get the existing Data instance off of URLRequest. | |
| 734 data_reduction_proxy::DataReductionProxyData* data_reduction_proxy_data = | |
| 735 data_reduction_proxy::DataReductionProxyData::DataForRequest(request, | |
| 736 false); | |
| 737 if (data_reduction_proxy_data) | |
| 738 data->SetDataReductionProxyData(data_reduction_proxy_data->DeepCopy()); | |
|
nasko
2016/04/26 20:18:39
So we end up doing two deep copies of data_reducti
RyanSturm
2016/04/27 23:27:46
I'll add a comment about this; the basic idea I ha
| |
| 739 return base::WrapUnique(data); | |
| 740 } | |
| OLD | NEW |