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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "content/public/browser/download_manager.h" | 63 #include "content/public/browser/download_manager.h" |
64 #include "content/public/browser/download_url_parameters.h" | 64 #include "content/public/browser/download_url_parameters.h" |
65 #include "content/public/browser/global_request_id.h" | 65 #include "content/public/browser/global_request_id.h" |
66 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 66 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
67 #include "content/public/browser/resource_request_details.h" | 67 #include "content/public/browser/resource_request_details.h" |
68 #include "content/public/browser/resource_throttle.h" | 68 #include "content/public/browser/resource_throttle.h" |
69 #include "content/public/browser/stream_handle.h" | 69 #include "content/public/browser/stream_handle.h" |
70 #include "content/public/browser/user_metrics.h" | 70 #include "content/public/browser/user_metrics.h" |
71 #include "content/public/common/content_switches.h" | 71 #include "content/public/common/content_switches.h" |
72 #include "content/public/common/process_type.h" | 72 #include "content/public/common/process_type.h" |
73 #include "content/public/common/url_constants.h" | |
74 #include "ipc/ipc_message_macros.h" | 73 #include "ipc/ipc_message_macros.h" |
75 #include "ipc/ipc_message_start.h" | 74 #include "ipc/ipc_message_start.h" |
76 #include "net/base/auth.h" | 75 #include "net/base/auth.h" |
77 #include "net/base/load_flags.h" | 76 #include "net/base/load_flags.h" |
78 #include "net/base/mime_util.h" | 77 #include "net/base/mime_util.h" |
79 #include "net/base/net_errors.h" | 78 #include "net/base/net_errors.h" |
80 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 79 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
81 #include "net/base/request_priority.h" | 80 #include "net/base/request_priority.h" |
82 #include "net/base/upload_data_stream.h" | 81 #include "net/base/upload_data_stream.h" |
83 #include "net/cert/cert_status_flags.h" | 82 #include "net/cert/cert_status_flags.h" |
84 #include "net/cookies/cookie_monster.h" | 83 #include "net/cookies/cookie_monster.h" |
85 #include "net/http/http_response_headers.h" | 84 #include "net/http/http_response_headers.h" |
86 #include "net/http/http_response_info.h" | 85 #include "net/http/http_response_info.h" |
87 #include "net/ssl/ssl_cert_request_info.h" | 86 #include "net/ssl/ssl_cert_request_info.h" |
88 #include "net/url_request/url_request.h" | 87 #include "net/url_request/url_request.h" |
89 #include "net/url_request/url_request_context.h" | 88 #include "net/url_request/url_request_context.h" |
90 #include "net/url_request/url_request_job_factory.h" | 89 #include "net/url_request/url_request_job_factory.h" |
| 90 #include "url/url_constants.h" |
91 #include "webkit/common/blob/blob_data.h" | 91 #include "webkit/common/blob/blob_data.h" |
92 #include "webkit/browser/blob/blob_data_handle.h" | 92 #include "webkit/browser/blob/blob_data_handle.h" |
93 #include "webkit/browser/blob/blob_storage_context.h" | 93 #include "webkit/browser/blob/blob_storage_context.h" |
94 #include "webkit/browser/blob/blob_url_request_job_factory.h" | 94 #include "webkit/browser/blob/blob_url_request_job_factory.h" |
95 #include "webkit/browser/fileapi/file_permission_policy.h" | 95 #include "webkit/browser/fileapi/file_permission_policy.h" |
96 #include "webkit/browser/fileapi/file_system_context.h" | 96 #include "webkit/browser/fileapi/file_system_context.h" |
97 #include "webkit/common/appcache/appcache_interfaces.h" | 97 #include "webkit/common/appcache/appcache_interfaces.h" |
98 #include "webkit/common/blob/shareable_file_reference.h" | 98 #include "webkit/common/blob/shareable_file_reference.h" |
99 | 99 |
100 using base::Time; | 100 using base::Time; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 VLOG(1) << "Download request for unsupported protocol: " | 526 VLOG(1) << "Download request for unsupported protocol: " |
527 << url.possibly_invalid_spec(); | 527 << url.possibly_invalid_spec(); |
528 return CallbackAndReturn(started_callback, | 528 return CallbackAndReturn(started_callback, |
529 DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST); | 529 DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST); |
530 } | 530 } |
531 | 531 |
532 ResourceRequestInfoImpl* extra_info = | 532 ResourceRequestInfoImpl* extra_info = |
533 CreateRequestInfo(child_id, route_id, true, context); | 533 CreateRequestInfo(child_id, route_id, true, context); |
534 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. | 534 extra_info->AssociateWithRequest(request.get()); // Request takes ownership. |
535 | 535 |
536 if (request->url().SchemeIs(kBlobScheme)) { | 536 if (request->url().SchemeIs(url::kBlobScheme)) { |
537 ChromeBlobStorageContext* blob_context = | 537 ChromeBlobStorageContext* blob_context = |
538 GetChromeBlobStorageContextForResourceContext(context); | 538 GetChromeBlobStorageContextForResourceContext(context); |
539 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( | 539 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( |
540 request.get(), | 540 request.get(), |
541 blob_context->context()->GetBlobDataFromPublicURL(request->url())); | 541 blob_context->context()->GetBlobDataFromPublicURL(request->url())); |
542 } | 542 } |
543 | 543 |
544 // From this point forward, the |DownloadResourceHandler| is responsible for | 544 // From this point forward, the |DownloadResourceHandler| is responsible for |
545 // |started_callback|. | 545 // |started_callback|. |
546 scoped_ptr<ResourceHandler> handler( | 546 scoped_ptr<ResourceHandler> handler( |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 allow_download, | 1084 allow_download, |
1085 request_data.has_user_gesture, | 1085 request_data.has_user_gesture, |
1086 request_data.referrer_policy, | 1086 request_data.referrer_policy, |
1087 request_data.visiblity_state, | 1087 request_data.visiblity_state, |
1088 resource_context, | 1088 resource_context, |
1089 filter_->GetWeakPtr(), | 1089 filter_->GetWeakPtr(), |
1090 !is_sync_load); | 1090 !is_sync_load); |
1091 // Request takes ownership. | 1091 // Request takes ownership. |
1092 extra_info->AssociateWithRequest(new_request.get()); | 1092 extra_info->AssociateWithRequest(new_request.get()); |
1093 | 1093 |
1094 if (new_request->url().SchemeIs(kBlobScheme)) { | 1094 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
1095 // Hang on to a reference to ensure the blob is not released prior | 1095 // Hang on to a reference to ensure the blob is not released prior |
1096 // to the job being started. | 1096 // to the job being started. |
1097 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( | 1097 webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( |
1098 new_request.get(), | 1098 new_request.get(), |
1099 filter_->blob_storage_context()->context()-> | 1099 filter_->blob_storage_context()->context()-> |
1100 GetBlobDataFromPublicURL(new_request->url())); | 1100 GetBlobDataFromPublicURL(new_request->url())); |
1101 } | 1101 } |
1102 | 1102 |
1103 // Initialize the service worker handler for the request. | 1103 // Initialize the service worker handler for the request. |
1104 ServiceWorkerRequestHandler::InitializeHandler( | 1104 ServiceWorkerRequestHandler::InitializeHandler( |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1972 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
1973 && !policy->CanReadRawCookies(child_id)) { | 1973 && !policy->CanReadRawCookies(child_id)) { |
1974 VLOG(1) << "Denied unauthorized request for raw headers"; | 1974 VLOG(1) << "Denied unauthorized request for raw headers"; |
1975 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1975 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
1976 } | 1976 } |
1977 | 1977 |
1978 return load_flags; | 1978 return load_flags; |
1979 } | 1979 } |
1980 | 1980 |
1981 } // namespace content | 1981 } // namespace content |
OLD | NEW |