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

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

Issue 2720763002: PlzNavigate: preserve SourceLocation when navigating (Closed)
Patch Set: Fix rebase compilation issues Created 3 years, 9 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // because it is loaded immediately by the FrameLoader. 670 // because it is loaded immediately by the FrameLoader.
671 FrameMsg_Navigate_Type::Value navigation_type = 671 FrameMsg_Navigate_Type::Value navigation_type =
672 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; 672 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
673 if (info.navigationType == blink::WebNavigationTypeReload) { 673 if (info.navigationType == blink::WebNavigationTypeReload) {
674 if (load_flags & net::LOAD_BYPASS_CACHE) 674 if (load_flags & net::LOAD_BYPASS_CACHE)
675 navigation_type = FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE; 675 navigation_type = FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE;
676 else 676 else
677 navigation_type = FrameMsg_Navigate_Type::RELOAD; 677 navigation_type = FrameMsg_Navigate_Type::RELOAD;
678 } 678 }
679 679
680 base::Optional<SourceLocation> source_location;
681 if (!info.sourceLocation.url.isNull()) {
682 source_location = SourceLocation(info.sourceLocation.url.latin1(),
683 info.sourceLocation.lineNumber,
684 info.sourceLocation.columnNumber);
685 }
686
680 const RequestExtraData* extra_data = 687 const RequestExtraData* extra_data =
681 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); 688 static_cast<RequestExtraData*>(info.urlRequest.getExtraData());
682 DCHECK(extra_data); 689 DCHECK(extra_data);
683 return CommonNavigationParams( 690 return CommonNavigationParams(
684 info.urlRequest.url(), referrer, extra_data->transition_type(), 691 info.urlRequest.url(), referrer, extra_data->transition_type(),
685 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp, 692 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp,
686 report_type, GURL(), GURL(), 693 report_type, GURL(), GURL(),
687 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()), 694 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()),
688 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), 695 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(),
689 GetRequestBodyForWebURLRequest(info.urlRequest)); 696 GetRequestBodyForWebURLRequest(info.urlRequest), source_location);
690 } 697 }
691 698
692 media::Context3D GetSharedMainThreadContext3D( 699 media::Context3D GetSharedMainThreadContext3D(
693 scoped_refptr<ui::ContextProviderCommandBuffer> provider) { 700 scoped_refptr<ui::ContextProviderCommandBuffer> provider) {
694 if (!provider) 701 if (!provider)
695 return media::Context3D(); 702 return media::Context3D();
696 return media::Context3D(provider->ContextGL(), provider->GrContext()); 703 return media::Context3D(provider->ContextGL(), provider->GrContext());
697 } 704 }
698 705
699 WebFrameLoadType ReloadFrameLoadTypeFor( 706 WebFrameLoadType ReloadFrameLoadTypeFor(
(...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after
3410 navigation_state->request_params().navigation_timing.fetch_start); 3417 navigation_state->request_params().navigation_timing.fetch_start);
3411 3418
3412 datasource->updateNavigation( 3419 datasource->updateNavigation(
3413 redirect_start, redirect_end, fetch_start, 3420 redirect_start, redirect_end, fetch_start,
3414 !navigation_state->request_params().redirects.empty()); 3421 !navigation_state->request_params().redirects.empty());
3415 // TODO(clamy) We need to provide additional timing values for the 3422 // TODO(clamy) We need to provide additional timing values for the
3416 // Navigation Timing API to work with browser-side navigations. 3423 // Navigation Timing API to work with browser-side navigations.
3417 // UnloadEventStart and UnloadEventEnd are still missing. 3424 // UnloadEventStart and UnloadEventEnd are still missing.
3418 } 3425 }
3419 3426
3427 // PlzNavigate: update the source location before processing the navigation
3428 // commit.
3429 if (IsBrowserSideNavigationEnabled() &&
3430 navigation_state->common_params().source_location.has_value()) {
3431 blink::WebSourceLocation source_location;
3432 source_location.url = WebString::fromLatin1(
3433 navigation_state->common_params().source_location->url);
3434 source_location.lineNumber =
3435 navigation_state->common_params().source_location->line_number;
3436 source_location.columnNumber =
3437 navigation_state->common_params().source_location->column_number;
3438 datasource->setSourceLocation(source_location);
3439 }
3440
3420 // Create the serviceworker's per-document network observing object if it 3441 // Create the serviceworker's per-document network observing object if it
3421 // does not exist (When navigation happens within a page, the provider already 3442 // does not exist (When navigation happens within a page, the provider already
3422 // exists). 3443 // exists).
3423 if (datasource->getServiceWorkerNetworkProvider()) 3444 if (datasource->getServiceWorkerNetworkProvider())
3424 return; 3445 return;
3425 3446
3426 datasource->setServiceWorkerNetworkProvider( 3447 datasource->setServiceWorkerNetworkProvider(
3427 ServiceWorkerNetworkProvider::CreateForNavigation( 3448 ServiceWorkerNetworkProvider::CreateForNavigation(
3428 routing_id_, navigation_state->request_params(), frame, 3449 routing_id_, navigation_state->request_params(), frame,
3429 content_initiated)); 3450 content_initiated));
(...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after
6116 // false, and the frame may not have been set in a loading state. Do not 6137 // false, and the frame may not have been set in a loading state. Do not
6117 // send a stop message if a history navigation is loading in this frame 6138 // send a stop message if a history navigation is loading in this frame
6118 // nonetheless. This behavior will go away with subframe navigation 6139 // nonetheless. This behavior will go away with subframe navigation
6119 // entries. 6140 // entries.
6120 if (frame_ && !frame_->isLoading() && !has_history_navigation_in_frame) 6141 if (frame_ && !frame_->isLoading() && !has_history_navigation_in_frame)
6121 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 6142 Send(new FrameHostMsg_DidStopLoading(routing_id_));
6122 } 6143 }
6123 6144
6124 // In case LoadRequest failed before didCreateDataSource was called. 6145 // In case LoadRequest failed before didCreateDataSource was called.
6125 pending_navigation_params_.reset(); 6146 pending_navigation_params_.reset();
6147
6148 // PlzNavigate: reset the source location now that the commit checks have been
6149 // processed.
6150 if (IsBrowserSideNavigationEnabled()) {
6151 frame_->dataSource()->resetSourceLocation();
6152 if (frame_->provisionalDataSource())
6153 frame_->provisionalDataSource()->resetSourceLocation();
6154 }
6126 } 6155 }
6127 6156
6128 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, 6157 void RenderFrameImpl::UpdateEncoding(WebFrame* frame,
6129 const std::string& encoding_name) { 6158 const std::string& encoding_name) {
6130 // Only update main frame's encoding_name. 6159 // Only update main frame's encoding_name.
6131 if (!frame->parent()) 6160 if (!frame->parent())
6132 Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name)); 6161 Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name));
6133 } 6162 }
6134 6163
6135 void RenderFrameImpl::SyncSelectionIfRequired() { 6164 void RenderFrameImpl::SyncSelectionIfRequired() {
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
6893 // event target. Potentially a Pepper plugin will receive the event. 6922 // event target. Potentially a Pepper plugin will receive the event.
6894 // In order to tell whether a plugin gets the last mouse event and which it 6923 // In order to tell whether a plugin gets the last mouse event and which it
6895 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6924 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6896 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6925 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6897 // |pepper_last_mouse_event_target_|. 6926 // |pepper_last_mouse_event_target_|.
6898 pepper_last_mouse_event_target_ = nullptr; 6927 pepper_last_mouse_event_target_ = nullptr;
6899 #endif 6928 #endif
6900 } 6929 }
6901 6930
6902 } // namespace content 6931 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698