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

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

Issue 2694013005: Cleanup blink-side PlzNavigate logic (Closed)
Patch Set: Rebase 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 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 // TODO(creis): Look into cleaning this up. 3307 // TODO(creis): Look into cleaning this up.
3308 return WebHistoryItem(); 3308 return WebHistoryItem();
3309 } 3309 }
3310 3310
3311 void RenderFrameImpl::willSendSubmitEvent(const blink::WebFormElement& form) { 3311 void RenderFrameImpl::willSendSubmitEvent(const blink::WebFormElement& form) {
3312 for (auto& observer : observers_) 3312 for (auto& observer : observers_)
3313 observer.WillSendSubmitEvent(form); 3313 observer.WillSendSubmitEvent(form);
3314 } 3314 }
3315 3315
3316 void RenderFrameImpl::willSubmitForm(const blink::WebFormElement& form) { 3316 void RenderFrameImpl::willSubmitForm(const blink::WebFormElement& form) {
3317 // With PlzNavigate-enabled, this will be called before a DataSource has been
3318 // set-up.
3319 // TODO(clamy): make sure the internal state is properly updated at some
3320 // point in the navigation.
3321 if (!IsBrowserSideNavigationEnabled() && !!frame_->provisionalDataSource()) {
3322 DocumentState* document_state = 3317 DocumentState* document_state =
3323 DocumentState::FromDataSource(frame_->provisionalDataSource()); 3318 DocumentState::FromDataSource(frame_->provisionalDataSource());
3324 NavigationStateImpl* navigation_state = 3319 NavigationStateImpl* navigation_state =
3325 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3320 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3326 InternalDocumentStateData* internal_data = 3321 InternalDocumentStateData* internal_data =
3327 InternalDocumentStateData::FromDocumentState(document_state); 3322 InternalDocumentStateData::FromDocumentState(document_state);
3328 3323
3329 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), 3324 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(),
3330 ui::PAGE_TRANSITION_LINK)) { 3325 ui::PAGE_TRANSITION_LINK)) {
3331 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT); 3326 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT);
3332 } 3327 }
3333 3328
3334 // Save these to be processed when the ensuing navigation is committed. 3329 // Save these to be processed when the ensuing navigation is committed.
3335 WebSearchableFormData web_searchable_form_data(form); 3330 WebSearchableFormData web_searchable_form_data(form);
3336 internal_data->set_searchable_form_url(web_searchable_form_data.url()); 3331 internal_data->set_searchable_form_url(web_searchable_form_data.url());
3337 internal_data->set_searchable_form_encoding( 3332 internal_data->set_searchable_form_encoding(
3338 web_searchable_form_data.encoding().utf8()); 3333 web_searchable_form_data.encoding().utf8());
3339 }
3340 3334
3341 for (auto& observer : observers_) 3335 for (auto& observer : observers_)
3342 observer.WillSubmitForm(form); 3336 observer.WillSubmitForm(form);
3343 } 3337 }
3344 3338
3345 void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame, 3339 void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame,
3346 blink::WebDataSource* datasource) { 3340 blink::WebDataSource* datasource) {
3347 DCHECK(!frame_ || frame_ == frame); 3341 DCHECK(!frame_ || frame_ == frame);
3348 3342
3349 bool content_initiated = !pending_navigation_params_.get(); 3343 bool content_initiated = !pending_navigation_params_.get();
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after
5227 // TODO(clamy): see if initial commits in subframes should be handled 5221 // TODO(clamy): see if initial commits in subframes should be handled
5228 // separately. 5222 // separately.
5229 bool replace = is_reload || common_params.url == GetLoadingUrl() || 5223 bool replace = is_reload || common_params.url == GetLoadingUrl() ||
5230 common_params.should_replace_current_entry; 5224 common_params.should_replace_current_entry;
5231 std::unique_ptr<HistoryEntry> history_entry; 5225 std::unique_ptr<HistoryEntry> history_entry;
5232 if (request_params.page_state.IsValid()) 5226 if (request_params.page_state.IsValid())
5233 history_entry = PageStateToHistoryEntry(request_params.page_state); 5227 history_entry = PageStateToHistoryEntry(request_params.page_state);
5234 5228
5235 // For renderer initiated navigations, we send out a didFailProvisionalLoad() 5229 // For renderer initiated navigations, we send out a didFailProvisionalLoad()
5236 // notification. 5230 // notification.
5237 if (request_params.nav_entry_id == 0) 5231 bool had_provisional_data_source = frame_->provisionalDataSource();
5238 didFailProvisionalLoad(frame_, error, blink::WebStandardCommit); 5232 if (request_params.nav_entry_id == 0) {
5239 LoadNavigationErrorPage(failed_request, error, replace, history_entry.get()); 5233 didFailProvisionalLoad(
5234 frame_, error,
5235 replace ? blink::WebHistoryInertCommit : blink::WebStandardCommit);
5236 }
5237
5238 // If we didn't call didFailProvisionalLoad or there wasn't a
5239 // provisionalDataSource(), LoadNavigationErrorPage wasn't called, so do it
5240 // now.
5241 if (request_params.nav_entry_id != 0 || !had_provisional_data_source) {
5242 LoadNavigationErrorPage(failed_request, error, replace,
5243 history_entry.get());
5244 }
5245
5240 browser_side_navigation_pending_ = false; 5246 browser_side_navigation_pending_ = false;
5241 } 5247 }
5242 5248
5243 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( 5249 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
5244 const NavigationPolicyInfo& info) { 5250 const NavigationPolicyInfo& info) {
5245 // A content initiated navigation may have originated from a link-click, 5251 // A content initiated navigation may have originated from a link-click,
5246 // script, drag-n-drop operation, etc. 5252 // script, drag-n-drop operation, etc.
5247 // info.extraData is only non-null if this is a redirect. Use the extraData 5253 // info.extraData is only non-null if this is a redirect. Use the extraData
5248 // initiation information for redirects, and check pending_navigation_params_ 5254 // initiation information for redirects, and check pending_navigation_params_
5249 // otherwise. 5255 // otherwise.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
5314 if (should_ask_browser) { 5320 if (should_ask_browser) {
5315 // Don't do this if |info| also says it is a client redirect, in which 5321 // Don't do this if |info| also says it is a client redirect, in which
5316 // case JavaScript on the page is trying to interrupt the history 5322 // case JavaScript on the page is trying to interrupt the history
5317 // navigation. 5323 // navigation.
5318 if (!info.isClientRedirect) { 5324 if (!info.isClientRedirect) {
5319 OpenURL(url, IsHttpPost(info.urlRequest), 5325 OpenURL(url, IsHttpPost(info.urlRequest),
5320 GetRequestBodyForWebURLRequest(info.urlRequest), 5326 GetRequestBodyForWebURLRequest(info.urlRequest),
5321 GetWebURLRequestHeaders(info.urlRequest), referrer, 5327 GetWebURLRequestHeaders(info.urlRequest), referrer,
5322 info.defaultPolicy, info.replacesCurrentHistoryItem, true); 5328 info.defaultPolicy, info.replacesCurrentHistoryItem, true);
5323 // Suppress the load in Blink but mark the frame as loading. 5329 // Suppress the load in Blink but mark the frame as loading.
5324 return blink::WebNavigationPolicyHandledByClient; 5330 return blink::WebNavigationPolicyHandledByClientForInitialHistory;
5325 } else { 5331 } else {
5326 // Client redirects during an initial history load should attempt to 5332 // Client redirects during an initial history load should attempt to
5327 // cancel the history navigation. They will create a provisional 5333 // cancel the history navigation. They will create a provisional
5328 // document loader, causing the history load to be ignored in 5334 // document loader, causing the history load to be ignored in
5329 // NavigateInternal, and this IPC will try to cancel any cross-process 5335 // NavigateInternal, and this IPC will try to cancel any cross-process
5330 // history load. 5336 // history load.
5331 Send(new FrameHostMsg_CancelInitialHistoryLoad(routing_id_)); 5337 Send(new FrameHostMsg_CancelInitialHistoryLoad(routing_id_));
5332 } 5338 }
5333 } 5339 }
5334 } 5340 }
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
6861 // event target. Potentially a Pepper plugin will receive the event. 6867 // event target. Potentially a Pepper plugin will receive the event.
6862 // In order to tell whether a plugin gets the last mouse event and which it 6868 // In order to tell whether a plugin gets the last mouse event and which it
6863 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6869 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6864 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6870 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6865 // |pepper_last_mouse_event_target_|. 6871 // |pepper_last_mouse_event_target_|.
6866 pepper_last_mouse_event_target_ = nullptr; 6872 pepper_last_mouse_event_target_ = nullptr;
6867 #endif 6873 #endif
6868 } 6874 }
6869 6875
6870 } // namespace content 6876 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/embeddedEnforcement/embedding_csp-header.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698