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

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

Issue 2652123002: PlzNavigate: Attempt to fix blink layout tests which fail due to duplicate output from WebFrameClie… (Closed)
Patch Set: Created 3 years, 11 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
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 549
550 // Returns false unless this is a top-level navigation. 550 // Returns false unless this is a top-level navigation.
551 bool IsTopLevelNavigation(WebFrame* frame) { 551 bool IsTopLevelNavigation(WebFrame* frame) {
552 return frame->parent() == NULL; 552 return frame->parent() == NULL;
553 } 553 }
554 554
555 WebURLRequest CreateURLRequestForNavigation( 555 WebURLRequest CreateURLRequestForNavigation(
556 const CommonNavigationParams& common_params, 556 const CommonNavigationParams& common_params,
557 std::unique_ptr<StreamOverrideParameters> stream_override, 557 std::unique_ptr<StreamOverrideParameters> stream_override,
558 bool is_view_source_mode_enabled) { 558 bool is_view_source_mode_enabled,
559 int nav_entry_id) {
559 WebURLRequest request(common_params.url); 560 WebURLRequest request(common_params.url);
560 if (is_view_source_mode_enabled) 561 if (is_view_source_mode_enabled)
561 request.setCachePolicy(WebCachePolicy::ReturnCacheDataElseLoad); 562 request.setCachePolicy(WebCachePolicy::ReturnCacheDataElseLoad);
562 563
563 request.setHTTPMethod(WebString::fromUTF8(common_params.method)); 564 request.setHTTPMethod(WebString::fromUTF8(common_params.method));
564 if (common_params.referrer.url.is_valid()) { 565 if (common_params.referrer.url.is_valid()) {
565 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader( 566 WebString web_referrer = WebSecurityPolicy::generateReferrerHeader(
566 common_params.referrer.policy, 567 common_params.referrer.policy,
567 common_params.url, 568 common_params.url,
568 WebString::fromUTF8(common_params.referrer.url.spec())); 569 WebString::fromUTF8(common_params.referrer.url.spec()));
(...skipping 14 matching lines...) Expand all
583 // Set the ui timestamp for this navigation. Currently the timestamp here is 584 // Set the ui timestamp for this navigation. Currently the timestamp here is
584 // only non empty when the navigation was triggered by an Android intent. The 585 // only non empty when the navigation was triggered by an Android intent. The
585 // timestamp is converted to a double version supported by blink. It will be 586 // timestamp is converted to a double version supported by blink. It will be
586 // passed back to the browser in the DidCommitProvisionalLoad and the 587 // passed back to the browser in the DidCommitProvisionalLoad and the
587 // DocumentLoadComplete IPCs. 588 // DocumentLoadComplete IPCs.
588 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks(); 589 base::TimeDelta ui_timestamp = common_params.ui_timestamp - base::TimeTicks();
589 request.setUiStartTime(ui_timestamp.InSecondsF()); 590 request.setUiStartTime(ui_timestamp.InSecondsF());
590 request.setInputPerfMetricReportPolicy( 591 request.setInputPerfMetricReportPolicy(
591 static_cast<WebURLRequest::InputToLoadPerfMetricReportPolicy>( 592 static_cast<WebURLRequest::InputToLoadPerfMetricReportPolicy>(
592 common_params.report_type)); 593 common_params.report_type));
594 request.setNavigationInitiatedByRenderer(nav_entry_id == 0);
593 return request; 595 return request;
594 } 596 }
595 597
596 // Sanitizes the navigation_start timestamp for browser-initiated navigations, 598 // Sanitizes the navigation_start timestamp for browser-initiated navigations,
597 // where the browser possibly has a better notion of start time than the 599 // where the browser possibly has a better notion of start time than the
598 // renderer. In the case of cross-process navigations, this carries over the 600 // renderer. In the case of cross-process navigations, this carries over the
599 // time of finishing the onbeforeunload handler of the previous page. 601 // time of finishing the onbeforeunload handler of the previous page.
600 // TimeTicks is sometimes not monotonic across processes, and because 602 // TimeTicks is sometimes not monotonic across processes, and because
601 // |browser_navigation_start| is likely before this process existed, 603 // |browser_navigation_start| is likely before this process existed,
602 // InterProcessTimeTicksConverter won't help. The timestamp is sanitized by 604 // InterProcessTimeTicksConverter won't help. The timestamp is sanitized by
(...skipping 4599 matching lines...) Expand 10 before | Expand all | Expand 10 after
5202 frame_->setCommittedFirstRealLoad(); 5204 frame_->setCommittedFirstRealLoad();
5203 5205
5204 pending_navigation_params_.reset(new NavigationParams( 5206 pending_navigation_params_.reset(new NavigationParams(
5205 common_params, StartNavigationParams(), request_params)); 5207 common_params, StartNavigationParams(), request_params));
5206 5208
5207 // Send the provisional load failure. 5209 // Send the provisional load failure.
5208 blink::WebURLError error = 5210 blink::WebURLError error =
5209 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); 5211 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code);
5210 WebURLRequest failed_request = CreateURLRequestForNavigation( 5212 WebURLRequest failed_request = CreateURLRequestForNavigation(
5211 common_params, std::unique_ptr<StreamOverrideParameters>(), 5213 common_params, std::unique_ptr<StreamOverrideParameters>(),
5212 frame_->isViewSourceModeEnabled()); 5214 frame_->isViewSourceModeEnabled(), request_params.nav_entry_id);
5213 5215
5214 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { 5216 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) {
5215 // The browser expects this frame to be loading an error page. Inform it 5217 // The browser expects this frame to be loading an error page. Inform it
5216 // that the load stopped. 5218 // that the load stopped.
5217 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 5219 Send(new FrameHostMsg_DidStopLoading(routing_id_));
5218 browser_side_navigation_pending_ = false; 5220 browser_side_navigation_pending_ = false;
5219 return; 5221 return;
5220 } 5222 }
5221 5223
5222 // On load failure, a frame can ask its owner to render fallback content. 5224 // On load failure, a frame can ask its owner to render fallback content.
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
5893 blink::WebFrameLoadType load_type = 5895 blink::WebFrameLoadType load_type =
5894 common_params.should_replace_current_entry 5896 common_params.should_replace_current_entry
5895 ? blink::WebFrameLoadType::ReplaceCurrentItem 5897 ? blink::WebFrameLoadType::ReplaceCurrentItem
5896 : blink::WebFrameLoadType::Standard; 5898 : blink::WebFrameLoadType::Standard;
5897 blink::WebHistoryLoadType history_load_type = 5899 blink::WebHistoryLoadType history_load_type =
5898 blink::WebHistoryDifferentDocumentLoad; 5900 blink::WebHistoryDifferentDocumentLoad;
5899 bool should_load_request = false; 5901 bool should_load_request = false;
5900 WebHistoryItem item_for_history_navigation; 5902 WebHistoryItem item_for_history_navigation;
5901 WebURLRequest request = 5903 WebURLRequest request =
5902 CreateURLRequestForNavigation(common_params, std::move(stream_params), 5904 CreateURLRequestForNavigation(common_params, std::move(stream_params),
5903 frame_->isViewSourceModeEnabled()); 5905 frame_->isViewSourceModeEnabled(),
5906 request_params.nav_entry_id);
5904 request.setFrameType(IsTopLevelNavigation(frame_) 5907 request.setFrameType(IsTopLevelNavigation(frame_)
5905 ? blink::WebURLRequest::FrameTypeTopLevel 5908 ? blink::WebURLRequest::FrameTypeTopLevel
5906 : blink::WebURLRequest::FrameTypeNested); 5909 : blink::WebURLRequest::FrameTypeNested);
5907 5910
5908 if (IsBrowserSideNavigationEnabled() && common_params.post_data) 5911 if (IsBrowserSideNavigationEnabled() && common_params.post_data)
5909 request.setHTTPBody(GetWebHTTPBodyForRequestBody(common_params.post_data)); 5912 request.setHTTPBody(GetWebHTTPBodyForRequestBody(common_params.post_data));
5910 5913
5911 // Used to determine whether this frame is actually loading a request as part 5914 // Used to determine whether this frame is actually loading a request as part
5912 // of a history navigation. 5915 // of a history navigation.
5913 bool has_history_navigation_in_frame = false; 5916 bool has_history_navigation_in_frame = false;
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
6878 // event target. Potentially a Pepper plugin will receive the event. 6881 // event target. Potentially a Pepper plugin will receive the event.
6879 // In order to tell whether a plugin gets the last mouse event and which it 6882 // In order to tell whether a plugin gets the last mouse event and which it
6880 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6883 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6881 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6884 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6882 // |pepper_last_mouse_event_target_|. 6885 // |pepper_last_mouse_event_target_|.
6883 pepper_last_mouse_event_target_ = nullptr; 6886 pepper_last_mouse_event_target_ = nullptr;
6884 #endif 6887 #endif
6885 } 6888 }
6886 6889
6887 } // namespace content 6890 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698