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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 88 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
89 #include "content/renderer/child_frame_compositing_helper.h" | 89 #include "content/renderer/child_frame_compositing_helper.h" |
90 #include "content/renderer/context_menu_params_builder.h" | 90 #include "content/renderer/context_menu_params_builder.h" |
91 #include "content/renderer/devtools/devtools_agent.h" | 91 #include "content/renderer/devtools/devtools_agent.h" |
92 #include "content/renderer/dom_automation_controller.h" | 92 #include "content/renderer/dom_automation_controller.h" |
93 #include "content/renderer/effective_connection_type_helper.h" | 93 #include "content/renderer/effective_connection_type_helper.h" |
94 #include "content/renderer/external_popup_menu.h" | 94 #include "content/renderer/external_popup_menu.h" |
95 #include "content/renderer/gpu/gpu_benchmarking_extension.h" | 95 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
96 #include "content/renderer/history_controller.h" | 96 #include "content/renderer/history_controller.h" |
97 #include "content/renderer/history_serialization.h" | 97 #include "content/renderer/history_serialization.h" |
| 98 #include "content/renderer/http_body_conversions.h" |
98 #include "content/renderer/image_downloader/image_downloader_impl.h" | 99 #include "content/renderer/image_downloader/image_downloader_impl.h" |
99 #include "content/renderer/ime_event_guard.h" | 100 #include "content/renderer/ime_event_guard.h" |
100 #include "content/renderer/internal_document_state_data.h" | 101 #include "content/renderer/internal_document_state_data.h" |
101 #include "content/renderer/manifest/manifest_manager.h" | 102 #include "content/renderer/manifest/manifest_manager.h" |
102 #include "content/renderer/media/audio_device_factory.h" | 103 #include "content/renderer/media/audio_device_factory.h" |
103 #include "content/renderer/media/media_permission_dispatcher.h" | 104 #include "content/renderer/media/media_permission_dispatcher.h" |
104 #include "content/renderer/media/media_stream_dispatcher.h" | 105 #include "content/renderer/media/media_stream_dispatcher.h" |
105 #include "content/renderer/media/media_stream_renderer_factory_impl.h" | 106 #include "content/renderer/media/media_stream_renderer_factory_impl.h" |
106 #include "content/renderer/media/midi_dispatcher.h" | 107 #include "content/renderer/media/midi_dispatcher.h" |
107 #include "content/renderer/media/render_media_log.h" | 108 #include "content/renderer/media/render_media_log.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 common_params.report_type)); | 541 common_params.report_type)); |
541 return request; | 542 return request; |
542 } | 543 } |
543 | 544 |
544 // Converts the HTTP body data stored in ResourceRequestBody format to a | 545 // Converts the HTTP body data stored in ResourceRequestBody format to a |
545 // WebHTTPBody, which is then added to the WebURLRequest. | 546 // WebHTTPBody, which is then added to the WebURLRequest. |
546 // PlzNavigate: used to add the POST data sent by the renderer at commit time | 547 // PlzNavigate: used to add the POST data sent by the renderer at commit time |
547 // to the WebURLRequest used to commit the navigation. This ensures that the | 548 // to the WebURLRequest used to commit the navigation. This ensures that the |
548 // POST data will be in the PageState sent to the browser on commit. | 549 // POST data will be in the PageState sent to the browser on commit. |
549 void AddHTTPBodyToRequest(WebURLRequest* request, | 550 void AddHTTPBodyToRequest(WebURLRequest* request, |
550 scoped_refptr<ResourceRequestBody> body) { | 551 const scoped_refptr<ResourceRequestBody>& body) { |
551 WebHTTPBody http_body; | 552 WebHTTPBody http_body; |
552 http_body.initialize(); | 553 http_body.initialize(); |
553 http_body.setIdentifier(body->identifier()); | 554 http_body.setIdentifier(body->identifier()); |
554 for (const ResourceRequestBody::Element& element : *(body->elements())) { | 555 for (const ResourceRequestBody::Element& element : *(body->elements())) |
555 long long length = -1; | 556 AppendHttpBodyElement(element, &http_body); |
556 switch (element.type()) { | |
557 case storage::DataElement::TYPE_BYTES: | |
558 http_body.appendData(WebData(element.bytes(), element.length())); | |
559 break; | |
560 case storage::DataElement::TYPE_FILE: | |
561 if (element.length() != std::numeric_limits<uint64_t>::max()) | |
562 length = element.length(); | |
563 http_body.appendFileRange( | |
564 element.path().AsUTF16Unsafe(), element.offset(), length, | |
565 element.expected_modification_time().ToDoubleT()); | |
566 break; | |
567 case storage::DataElement::TYPE_FILE_FILESYSTEM: | |
568 http_body.appendFileSystemURLRange( | |
569 element.filesystem_url(), element.offset(), element.length(), | |
570 element.expected_modification_time().ToDoubleT()); | |
571 break; | |
572 case storage::DataElement::TYPE_BLOB: | |
573 http_body.appendBlob(WebString::fromUTF8(element.blob_uuid())); | |
574 break; | |
575 default: | |
576 // TYPE_BYTES_DESCRIPTION and TYPE_DISK_CACHE_ENTRY should not be | |
577 // encountered. | |
578 NOTREACHED(); | |
579 break; | |
580 } | |
581 } | |
582 request->setHTTPBody(http_body); | 557 request->setHTTPBody(http_body); |
583 } | 558 } |
584 | 559 |
585 // Sanitizes the navigation_start timestamp for browser-initiated navigations, | 560 // Sanitizes the navigation_start timestamp for browser-initiated navigations, |
586 // where the browser possibly has a better notion of start time than the | 561 // where the browser possibly has a better notion of start time than the |
587 // renderer. In the case of cross-process navigations, this carries over the | 562 // renderer. In the case of cross-process navigations, this carries over the |
588 // time of finishing the onbeforeunload handler of the previous page. | 563 // time of finishing the onbeforeunload handler of the previous page. |
589 // TimeTicks is sometimes not monotonic across processes, and because | 564 // TimeTicks is sometimes not monotonic across processes, and because |
590 // |browser_navigation_start| is likely before this process existed, | 565 // |browser_navigation_start| is likely before this process existed, |
591 // InterProcessTimeTicksConverter won't help. The timestamp is sanitized by | 566 // InterProcessTimeTicksConverter won't help. The timestamp is sanitized by |
(...skipping 5612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6204 // event target. Potentially a Pepper plugin will receive the event. | 6179 // event target. Potentially a Pepper plugin will receive the event. |
6205 // In order to tell whether a plugin gets the last mouse event and which it | 6180 // In order to tell whether a plugin gets the last mouse event and which it |
6206 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6181 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6207 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6182 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6208 // |pepper_last_mouse_event_target_|. | 6183 // |pepper_last_mouse_event_target_|. |
6209 pepper_last_mouse_event_target_ = nullptr; | 6184 pepper_last_mouse_event_target_ = nullptr; |
6210 #endif | 6185 #endif |
6211 } | 6186 } |
6212 | 6187 |
6213 } // namespace content | 6188 } // namespace content |
OLD | NEW |