Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2006053004: Relanding: Deduplicating code performing WebHTTPBody::Element conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/http_body_conversions.cc ('k') | storage/common/data_element.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 87 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
88 #include "content/renderer/child_frame_compositing_helper.h" 88 #include "content/renderer/child_frame_compositing_helper.h"
89 #include "content/renderer/context_menu_params_builder.h" 89 #include "content/renderer/context_menu_params_builder.h"
90 #include "content/renderer/devtools/devtools_agent.h" 90 #include "content/renderer/devtools/devtools_agent.h"
91 #include "content/renderer/dom_automation_controller.h" 91 #include "content/renderer/dom_automation_controller.h"
92 #include "content/renderer/effective_connection_type_helper.h" 92 #include "content/renderer/effective_connection_type_helper.h"
93 #include "content/renderer/external_popup_menu.h" 93 #include "content/renderer/external_popup_menu.h"
94 #include "content/renderer/gpu/gpu_benchmarking_extension.h" 94 #include "content/renderer/gpu/gpu_benchmarking_extension.h"
95 #include "content/renderer/history_controller.h" 95 #include "content/renderer/history_controller.h"
96 #include "content/renderer/history_serialization.h" 96 #include "content/renderer/history_serialization.h"
97 #include "content/renderer/http_body_conversions.h"
97 #include "content/renderer/image_downloader/image_downloader_impl.h" 98 #include "content/renderer/image_downloader/image_downloader_impl.h"
98 #include "content/renderer/ime_event_guard.h" 99 #include "content/renderer/ime_event_guard.h"
99 #include "content/renderer/internal_document_state_data.h" 100 #include "content/renderer/internal_document_state_data.h"
100 #include "content/renderer/manifest/manifest_manager.h" 101 #include "content/renderer/manifest/manifest_manager.h"
101 #include "content/renderer/media/audio_device_factory.h" 102 #include "content/renderer/media/audio_device_factory.h"
102 #include "content/renderer/media/media_permission_dispatcher.h" 103 #include "content/renderer/media/media_permission_dispatcher.h"
103 #include "content/renderer/media/media_stream_dispatcher.h" 104 #include "content/renderer/media/media_stream_dispatcher.h"
104 #include "content/renderer/media/media_stream_renderer_factory_impl.h" 105 #include "content/renderer/media/media_stream_renderer_factory_impl.h"
105 #include "content/renderer/media/midi_dispatcher.h" 106 #include "content/renderer/media/midi_dispatcher.h"
106 #include "content/renderer/media/render_media_log.h" 107 #include "content/renderer/media/render_media_log.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const 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 5590 matching lines...) Expand 10 before | Expand all | Expand 10 after
6182 // event target. Potentially a Pepper plugin will receive the event. 6157 // event target. Potentially a Pepper plugin will receive the event.
6183 // In order to tell whether a plugin gets the last mouse event and which it 6158 // In order to tell whether a plugin gets the last mouse event and which it
6184 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6159 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6185 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6160 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6186 // |pepper_last_mouse_event_target_|. 6161 // |pepper_last_mouse_event_target_|.
6187 pepper_last_mouse_event_target_ = nullptr; 6162 pepper_last_mouse_event_target_ = nullptr;
6188 #endif 6163 #endif
6189 } 6164 }
6190 6165
6191 } // namespace content 6166 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/http_body_conversions.cc ('k') | storage/common/data_element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698