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 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 33 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
34 #include "chrome/browser/signin/chrome_signin_helper.h" | 34 #include "chrome/browser/signin/chrome_signin_helper.h" |
35 #include "chrome/browser/tab_contents/tab_util.h" | 35 #include "chrome/browser/tab_contents/tab_util.h" |
36 #include "chrome/browser/ui/login/login_prompt.h" | 36 #include "chrome/browser/ui/login/login_prompt.h" |
37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/common/features.h" | 38 #include "chrome/common/features.h" |
39 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
40 #include "components/content_settings/core/browser/host_content_settings_map.h" | 40 #include "components/content_settings/core/browser/host_content_settings_map.h" |
41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
42 #include "components/google/core/browser/google_util.h" | 42 #include "components/google/core/browser/google_util.h" |
| 43 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
43 #include "components/variations/net/variations_http_headers.h" | 44 #include "components/variations/net/variations_http_headers.h" |
44 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/plugin_service.h" | 47 #include "content/public/browser/plugin_service.h" |
47 #include "content/public/browser/plugin_service_filter.h" | 48 #include "content/public/browser/plugin_service_filter.h" |
48 #include "content/public/browser/render_process_host.h" | 49 #include "content/public/browser/render_process_host.h" |
49 #include "content/public/browser/render_view_host.h" | 50 #include "content/public/browser/render_view_host.h" |
50 #include "content/public/browser/resource_context.h" | 51 #include "content/public/browser/resource_context.h" |
51 #include "content/public/browser/resource_dispatcher_host.h" | 52 #include "content/public/browser/resource_dispatcher_host.h" |
52 #include "content/public/browser/resource_request_info.h" | 53 #include "content/public/browser/resource_request_info.h" |
53 #include "content/public/browser/service_worker_context.h" | 54 #include "content/public/browser/service_worker_context.h" |
54 #include "content/public/browser/stream_info.h" | 55 #include "content/public/browser/stream_info.h" |
55 #include "content/public/browser/web_contents.h" | 56 #include "content/public/browser/web_contents.h" |
56 #include "content/public/common/resource_response.h" | 57 #include "content/public/common/resource_response.h" |
57 #include "net/base/load_flags.h" | 58 #include "net/base/load_flags.h" |
58 #include "net/base/load_timing_info.h" | 59 #include "net/base/load_timing_info.h" |
59 #include "net/base/request_priority.h" | 60 #include "net/base/request_priority.h" |
60 #include "net/http/http_response_headers.h" | 61 #include "net/http/http_response_headers.h" |
61 #include "net/url_request/url_request.h" | 62 #include "net/url_request/url_request.h" |
62 | 63 |
63 #if !defined(DISABLE_NACL) | 64 #if !defined(DISABLE_NACL) |
64 #include "chrome/browser/component_updater/pnacl_component_installer.h" | 65 #include "chrome/browser/component_updater/pnacl_component_installer.h" |
65 #endif | 66 #endif |
66 | 67 |
67 #if defined(ENABLE_CONFIGURATION_POLICY) | |
68 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | |
69 #endif | |
70 | |
71 #if defined(ENABLE_EXTENSIONS) | 68 #if defined(ENABLE_EXTENSIONS) |
72 #include "chrome/browser/apps/app_url_redirector.h" | 69 #include "chrome/browser/apps/app_url_redirector.h" |
73 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" | 70 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" |
74 #include "chrome/browser/extensions/user_script_listener.h" | 71 #include "chrome/browser/extensions/user_script_listener.h" |
75 #include "extensions/browser/extension_throttle_manager.h" | 72 #include "extensions/browser/extension_throttle_manager.h" |
76 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | 73 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
77 #include "extensions/browser/info_map.h" | 74 #include "extensions/browser/info_map.h" |
78 #include "extensions/common/constants.h" | 75 #include "extensions/common/constants.h" |
79 #include "extensions/common/extension_urls.h" | 76 #include "extensions/common/extension_urls.h" |
80 #include "extensions/common/manifest_handlers/mime_types_handler.h" | 77 #include "extensions/common/manifest_handlers/mime_types_handler.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 net::HttpRequestHeaders headers; | 355 net::HttpRequestHeaders headers; |
359 headers.CopyFrom(request->extra_request_headers()); | 356 headers.CopyFrom(request->extra_request_headers()); |
360 bool is_off_the_record = io_data->IsOffTheRecord(); | 357 bool is_off_the_record = io_data->IsOffTheRecord(); |
361 variations::AppendVariationHeaders( | 358 variations::AppendVariationHeaders( |
362 request->url(), is_off_the_record, | 359 request->url(), is_off_the_record, |
363 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(), | 360 !is_off_the_record && io_data->GetMetricsEnabledStateOnIOThread(), |
364 &headers); | 361 &headers); |
365 request->SetExtraRequestHeaders(headers); | 362 request->SetExtraRequestHeaders(headers); |
366 } | 363 } |
367 | 364 |
368 #if defined(ENABLE_CONFIGURATION_POLICY) | |
369 if (io_data->policy_header_helper()) | 365 if (io_data->policy_header_helper()) |
370 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); | 366 io_data->policy_header_helper()->AddPolicyHeaders(request->url(), request); |
371 #endif | |
372 | 367 |
373 signin::AppendMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, | 368 signin::AppendMirrorRequestHeaderHelper(request, GURL() /* redirect_url */, |
374 io_data, info->GetChildID(), | 369 io_data, info->GetChildID(), |
375 info->GetRouteID()); | 370 info->GetRouteID()); |
376 | 371 |
377 AppendStandardResourceThrottles(request, | 372 AppendStandardResourceThrottles(request, |
378 resource_context, | 373 resource_context, |
379 resource_type, | 374 resource_type, |
380 throttles); | 375 throttles); |
381 #if !defined(DISABLE_NACL) | 376 #if !defined(DISABLE_NACL) |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 // exception is requests from gaia webview, since the native profile | 673 // exception is requests from gaia webview, since the native profile |
679 // management UI is built on top of it. | 674 // management UI is built on top of it. |
680 signin::AppendMirrorRequestHeaderHelper( | 675 signin::AppendMirrorRequestHeaderHelper( |
681 request, redirect_url, io_data, info->GetChildID(), info->GetRouteID()); | 676 request, redirect_url, io_data, info->GetChildID(), info->GetRouteID()); |
682 | 677 |
683 if (io_data->resource_prefetch_predictor_observer()) { | 678 if (io_data->resource_prefetch_predictor_observer()) { |
684 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( | 679 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( |
685 redirect_url, request); | 680 redirect_url, request); |
686 } | 681 } |
687 | 682 |
688 #if defined(ENABLE_CONFIGURATION_POLICY) | |
689 if (io_data->policy_header_helper()) | 683 if (io_data->policy_header_helper()) |
690 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); | 684 io_data->policy_header_helper()->AddPolicyHeaders(redirect_url, request); |
691 #endif | |
692 } | 685 } |
693 | 686 |
694 // Notification that a request has completed. | 687 // Notification that a request has completed. |
695 void ChromeResourceDispatcherHostDelegate::RequestComplete( | 688 void ChromeResourceDispatcherHostDelegate::RequestComplete( |
696 net::URLRequest* url_request) { | 689 net::URLRequest* url_request) { |
697 // Jump on the UI thread and inform the prerender about the bytes. | 690 // Jump on the UI thread and inform the prerender about the bytes. |
698 const ResourceRequestInfo* info = | 691 const ResourceRequestInfo* info = |
699 ResourceRequestInfo::ForRequest(url_request); | 692 ResourceRequestInfo::ForRequest(url_request); |
700 if (url_request && !url_request->was_cached()) { | 693 if (url_request && !url_request->was_cached()) { |
701 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 694 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
(...skipping 14 matching lines...) Expand all Loading... |
716 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); | 709 return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); |
717 return false; | 710 return false; |
718 } | 711 } |
719 | 712 |
720 // static | 713 // static |
721 void ChromeResourceDispatcherHostDelegate:: | 714 void ChromeResourceDispatcherHostDelegate:: |
722 SetExternalProtocolHandlerDelegateForTesting( | 715 SetExternalProtocolHandlerDelegateForTesting( |
723 ExternalProtocolHandler::Delegate* delegate) { | 716 ExternalProtocolHandler::Delegate* delegate) { |
724 g_external_protocol_handler_delegate = delegate; | 717 g_external_protocol_handler_delegate = delegate; |
725 } | 718 } |
OLD | NEW |