OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 #include "media/blink/webencryptedmediaclient_impl.h" | 143 #include "media/blink/webencryptedmediaclient_impl.h" |
144 #include "media/blink/webmediaplayer_impl.h" | 144 #include "media/blink/webmediaplayer_impl.h" |
145 #include "media/renderers/gpu_video_accelerator_factories.h" | 145 #include "media/renderers/gpu_video_accelerator_factories.h" |
146 #include "mojo/common/url_type_converters.h" | 146 #include "mojo/common/url_type_converters.h" |
147 #include "mojo/edk/js/core.h" | 147 #include "mojo/edk/js/core.h" |
148 #include "mojo/edk/js/support.h" | 148 #include "mojo/edk/js/support.h" |
149 #include "net/base/data_url.h" | 149 #include "net/base/data_url.h" |
150 #include "net/base/net_errors.h" | 150 #include "net/base/net_errors.h" |
151 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 151 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
152 #include "net/http/http_util.h" | 152 #include "net/http/http_util.h" |
| 153 #include "storage/common/data_element.h" |
153 #include "third_party/WebKit/public/platform/URLConversion.h" | 154 #include "third_party/WebKit/public/platform/URLConversion.h" |
154 #include "third_party/WebKit/public/platform/WebCachePolicy.h" | 155 #include "third_party/WebKit/public/platform/WebCachePolicy.h" |
155 #include "third_party/WebKit/public/platform/WebData.h" | 156 #include "third_party/WebKit/public/platform/WebData.h" |
156 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 157 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
157 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" | 158 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" |
158 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 159 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
159 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" | 160 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" |
160 #include "third_party/WebKit/public/platform/WebString.h" | 161 #include "third_party/WebKit/public/platform/WebString.h" |
161 #include "third_party/WebKit/public/platform/WebURL.h" | 162 #include "third_party/WebKit/public/platform/WebURL.h" |
162 #include "third_party/WebKit/public/platform/WebURLError.h" | 163 #include "third_party/WebKit/public/platform/WebURLError.h" |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 url::Origin(GURL(main_ds->request().url()))) || | 753 url::Origin(GURL(main_ds->request().url()))) || |
753 main_resource_ssl_status.security_style != | 754 main_resource_ssl_status.security_style != |
754 ssl_status.security_style || | 755 ssl_status.security_style || |
755 main_resource_ssl_status.cert_id != ssl_status.cert_id || | 756 main_resource_ssl_status.cert_id != ssl_status.cert_id || |
756 main_resource_ssl_status.cert_status != ssl_status.cert_status || | 757 main_resource_ssl_status.cert_status != ssl_status.cert_status || |
757 main_resource_ssl_status.security_bits != ssl_status.security_bits || | 758 main_resource_ssl_status.security_bits != ssl_status.security_bits || |
758 main_resource_ssl_status.connection_status != | 759 main_resource_ssl_status.connection_status != |
759 ssl_status.connection_status); | 760 ssl_status.connection_status); |
760 } | 761 } |
761 | 762 |
| 763 WebHTTPBody CreateWebHttpBodyFromResourceRequestBody( |
| 764 const scoped_refptr<ResourceRequestBody> body) { |
| 765 WebHTTPBody result; |
| 766 result.initialize(); |
| 767 for (const ResourceRequestBody::Element& elem : *body->elements()) { |
| 768 switch (elem.type()) { |
| 769 case ResourceRequestBody::Element::TYPE_BYTES: |
| 770 result.appendData(WebData(elem.bytes(), elem.length())); |
| 771 break; |
| 772 case ResourceRequestBody::Element::TYPE_FILE: |
| 773 result.appendFileRange(WebString::fromUTF8(elem.path().AsUTF8Unsafe()), |
| 774 elem.offset(), elem.length(), |
| 775 elem.expected_modification_time().ToDoubleT()); |
| 776 break; |
| 777 case ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM: |
| 778 result.appendFileSystemURLRange( |
| 779 elem.filesystem_url(), elem.offset(), elem.length(), |
| 780 elem.expected_modification_time().ToDoubleT()); |
| 781 break; |
| 782 case ResourceRequestBody::Element::TYPE_BLOB: |
| 783 result.appendBlob(WebString::fromUTF8(elem.blob_uuid())); |
| 784 break; |
| 785 default: |
| 786 NOTIMPLEMENTED(); |
| 787 break; |
| 788 } |
| 789 } |
| 790 return result; |
| 791 } |
| 792 |
762 #if defined(OS_ANDROID) | 793 #if defined(OS_ANDROID) |
763 // Returns true if WMPI should be used for playback, false otherwise. | 794 // Returns true if WMPI should be used for playback, false otherwise. |
764 // | 795 // |
765 // Note that HLS and MP4 detection are pre-redirect and path-based. It is | 796 // Note that HLS and MP4 detection are pre-redirect and path-based. It is |
766 // possible to load such a URL and find different content. | 797 // possible to load such a URL and find different content. |
767 bool UseWebMediaPlayerImpl(const GURL& url) { | 798 bool UseWebMediaPlayerImpl(const GURL& url) { |
768 // WMPI does not support HLS. | 799 // WMPI does not support HLS. |
769 if (media::MediaCodecUtil::IsHLSURL(url)) | 800 if (media::MediaCodecUtil::IsHLSURL(url)) |
770 return false; | 801 return false; |
771 | 802 |
(...skipping 4620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5392 start_params.extra_headers.end(), | 5423 start_params.extra_headers.end(), |
5393 "\n"); | 5424 "\n"); |
5394 i.GetNext();) { | 5425 i.GetNext();) { |
5395 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), | 5426 request.addHTTPHeaderField(WebString::fromUTF8(i.name()), |
5396 WebString::fromUTF8(i.values())); | 5427 WebString::fromUTF8(i.values())); |
5397 } | 5428 } |
5398 } | 5429 } |
5399 | 5430 |
5400 if (common_params.method == "POST" && !browser_side_navigation) { | 5431 if (common_params.method == "POST" && !browser_side_navigation) { |
5401 // Set post data. | 5432 // Set post data. |
5402 WebHTTPBody http_body; | 5433 request.setHTTPBody( |
5403 http_body.initialize(); | 5434 CreateWebHttpBodyFromResourceRequestBody(start_params.post_data)); |
5404 const char* data = nullptr; | |
5405 if (start_params.browser_initiated_post_data.size()) { | |
5406 data = reinterpret_cast<const char*>( | |
5407 &start_params.browser_initiated_post_data.front()); | |
5408 } | |
5409 http_body.appendData( | |
5410 WebData(data, start_params.browser_initiated_post_data.size())); | |
5411 request.setHTTPBody(http_body); | |
5412 } | 5435 } |
5413 | 5436 |
5414 // A session history navigation should have been accompanied by state. | 5437 // A session history navigation should have been accompanied by state. |
5415 CHECK_EQ(request_params.page_id, -1); | 5438 CHECK_EQ(request_params.page_id, -1); |
5416 | 5439 |
5417 should_load_request = true; | 5440 should_load_request = true; |
5418 } | 5441 } |
5419 | 5442 |
5420 if (should_load_request) { | 5443 if (should_load_request) { |
5421 // Sanitize navigation start now that we know the load_type. | 5444 // Sanitize navigation start now that we know the load_type. |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6048 int match_count, | 6071 int match_count, |
6049 int ordinal, | 6072 int ordinal, |
6050 const WebRect& selection_rect, | 6073 const WebRect& selection_rect, |
6051 bool final_status_update) { | 6074 bool final_status_update) { |
6052 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6075 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6053 selection_rect, ordinal, | 6076 selection_rect, ordinal, |
6054 final_status_update)); | 6077 final_status_update)); |
6055 } | 6078 } |
6056 | 6079 |
6057 } // namespace content | 6080 } // namespace content |
OLD | NEW |