OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "components/mime_util/mime_util.h" |
18 #include "content/child/child_thread_impl.h" | 19 #include "content/child/child_thread_impl.h" |
19 #include "content/child/ftp_directory_listing_response_delegate.h" | 20 #include "content/child/ftp_directory_listing_response_delegate.h" |
20 #include "content/child/multipart_response_delegate.h" | 21 #include "content/child/multipart_response_delegate.h" |
21 #include "content/child/request_extra_data.h" | 22 #include "content/child/request_extra_data.h" |
22 #include "content/child/request_info.h" | 23 #include "content/child/request_info.h" |
23 #include "content/child/resource_dispatcher.h" | 24 #include "content/child/resource_dispatcher.h" |
24 #include "content/child/sync_load_response.h" | 25 #include "content/child/sync_load_response.h" |
25 #include "content/child/web_data_consumer_handle_impl.h" | 26 #include "content/child/web_data_consumer_handle_impl.h" |
26 #include "content/child/web_url_request_util.h" | 27 #include "content/child/web_url_request_util.h" |
27 #include "content/child/weburlresponse_extradata_impl.h" | 28 #include "content/child/weburlresponse_extradata_impl.h" |
28 #include "content/common/resource_messages.h" | 29 #include "content/common/resource_messages.h" |
29 #include "content/common/resource_request_body.h" | 30 #include "content/common/resource_request_body.h" |
30 #include "content/common/service_worker/service_worker_types.h" | 31 #include "content/common/service_worker/service_worker_types.h" |
31 #include "content/public/child/request_peer.h" | 32 #include "content/public/child/request_peer.h" |
32 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
33 #include "net/base/data_url.h" | 34 #include "net/base/data_url.h" |
34 #include "net/base/filename_util.h" | 35 #include "net/base/filename_util.h" |
35 #include "net/base/mime_util.h" | |
36 #include "net/base/net_errors.h" | 36 #include "net/base/net_errors.h" |
37 #include "net/http/http_response_headers.h" | 37 #include "net/http/http_response_headers.h" |
38 #include "net/http/http_util.h" | 38 #include "net/http/http_util.h" |
39 #include "net/url_request/redirect_info.h" | 39 #include "net/url_request/redirect_info.h" |
40 #include "net/url_request/url_request_data_job.h" | 40 #include "net/url_request/url_request_data_job.h" |
41 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h" | 41 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h" |
42 #include "third_party/WebKit/public/platform/WebURL.h" | 42 #include "third_party/WebKit/public/platform/WebURL.h" |
43 #include "third_party/WebKit/public/platform/WebURLError.h" | 43 #include "third_party/WebKit/public/platform/WebURLError.h" |
44 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h" | 44 #include "third_party/WebKit/public/platform/WebURLLoadTiming.h" |
45 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 45 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 if (request_.frameType() == WebURLRequest::FrameTypeTopLevel) | 796 if (request_.frameType() == WebURLRequest::FrameTypeTopLevel) |
797 return false; | 797 return false; |
798 #endif | 798 #endif |
799 | 799 |
800 if (request_.frameType() != WebURLRequest::FrameTypeTopLevel && | 800 if (request_.frameType() != WebURLRequest::FrameTypeTopLevel && |
801 request_.frameType() != WebURLRequest::FrameTypeNested) | 801 request_.frameType() != WebURLRequest::FrameTypeNested) |
802 return true; | 802 return true; |
803 | 803 |
804 std::string mime_type, unused_charset; | 804 std::string mime_type, unused_charset; |
805 if (net::DataURL::Parse(request_.url(), &mime_type, &unused_charset, NULL) && | 805 if (net::DataURL::Parse(request_.url(), &mime_type, &unused_charset, NULL) && |
806 net::IsSupportedMimeType(mime_type)) | 806 mime_util::IsSupportedMimeType(mime_type)) |
807 return true; | 807 return true; |
808 | 808 |
809 return false; | 809 return false; |
810 } | 810 } |
811 | 811 |
812 void WebURLLoaderImpl::Context::HandleDataURL() { | 812 void WebURLLoaderImpl::Context::HandleDataURL() { |
813 DCHECK_NE(defers_loading_, DEFERRED_DATA); | 813 DCHECK_NE(defers_loading_, DEFERRED_DATA); |
814 if (defers_loading_ == SHOULD_DEFER) { | 814 if (defers_loading_ == SHOULD_DEFER) { |
815 defers_loading_ = DEFERRED_DATA; | 815 defers_loading_ = DEFERRED_DATA; |
816 return; | 816 return; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 int intra_priority_value) { | 1117 int intra_priority_value) { |
1118 context_->DidChangePriority(new_priority, intra_priority_value); | 1118 context_->DidChangePriority(new_priority, intra_priority_value); |
1119 } | 1119 } |
1120 | 1120 |
1121 bool WebURLLoaderImpl::attachThreadedDataReceiver( | 1121 bool WebURLLoaderImpl::attachThreadedDataReceiver( |
1122 blink::WebThreadedDataReceiver* threaded_data_receiver) { | 1122 blink::WebThreadedDataReceiver* threaded_data_receiver) { |
1123 return context_->AttachThreadedDataReceiver(threaded_data_receiver); | 1123 return context_->AttachThreadedDataReceiver(threaded_data_receiver); |
1124 } | 1124 } |
1125 | 1125 |
1126 } // namespace content | 1126 } // namespace content |
OLD | NEW |