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

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

Issue 1446253002: PlzNavigate: inform the WebFrameClient that a form will be submitted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « no previous file | testing/buildbot/filters/browser-side-navigation.linux.browser_tests.filter » ('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 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after
2871 return WebHistoryItem(); 2871 return WebHistoryItem();
2872 2872
2873 return render_view_->history_controller()->GetItemForNewChildFrame(this); 2873 return render_view_->history_controller()->GetItemForNewChildFrame(this);
2874 } 2874 }
2875 2875
2876 void RenderFrameImpl::willSendSubmitEvent(const blink::WebFormElement& form) { 2876 void RenderFrameImpl::willSendSubmitEvent(const blink::WebFormElement& form) {
2877 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSendSubmitEvent(form)); 2877 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSendSubmitEvent(form));
2878 } 2878 }
2879 2879
2880 void RenderFrameImpl::willSubmitForm(const blink::WebFormElement& form) { 2880 void RenderFrameImpl::willSubmitForm(const blink::WebFormElement& form) {
2881 DocumentState* document_state = 2881 // With PlzNavigate-enabled, this will be called before a DataSource has been
2882 DocumentState::FromDataSource(frame_->provisionalDataSource()); 2882 // set-up.
2883 NavigationStateImpl* navigation_state = 2883 // TODO(clamy): make sure the internal state is properly updated at some
2884 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 2884 // point in the navigation.
2885 InternalDocumentStateData* internal_data = 2885 if (!IsBrowserSideNavigationEnabled()) {
2886 InternalDocumentStateData::FromDocumentState(document_state); 2886 DocumentState* document_state =
2887 DocumentState::FromDataSource(frame_->provisionalDataSource());
2888 NavigationStateImpl* navigation_state =
2889 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2890 InternalDocumentStateData* internal_data =
2891 InternalDocumentStateData::FromDocumentState(document_state);
2887 2892
2888 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(), 2893 if (ui::PageTransitionCoreTypeIs(navigation_state->GetTransitionType(),
2889 ui::PAGE_TRANSITION_LINK)) { 2894 ui::PAGE_TRANSITION_LINK)) {
2890 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT); 2895 navigation_state->set_transition_type(ui::PAGE_TRANSITION_FORM_SUBMIT);
2896 }
2897
2898 // Save these to be processed when the ensuing navigation is committed.
2899 WebSearchableFormData web_searchable_form_data(form);
2900 internal_data->set_searchable_form_url(web_searchable_form_data.url());
2901 internal_data->set_searchable_form_encoding(
2902 web_searchable_form_data.encoding().utf8());
2891 } 2903 }
2892 2904
2893 // Save these to be processed when the ensuing navigation is committed.
2894 WebSearchableFormData web_searchable_form_data(form);
2895 internal_data->set_searchable_form_url(web_searchable_form_data.url());
2896 internal_data->set_searchable_form_encoding(
2897 web_searchable_form_data.encoding().utf8());
2898
2899 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSubmitForm(form)); 2905 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WillSubmitForm(form));
2900 } 2906 }
2901 2907
2902 void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame, 2908 void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame,
2903 blink::WebDataSource* datasource) { 2909 blink::WebDataSource* datasource) {
2904 DCHECK(!frame_ || frame_ == frame); 2910 DCHECK(!frame_ || frame_ == frame);
2905 2911
2906 bool content_initiated = !pending_navigation_params_.get(); 2912 bool content_initiated = !pending_navigation_params_.get();
2907 2913
2908 // Make sure any previous redirect URLs end up in our new data source. 2914 // Make sure any previous redirect URLs end up in our new data source.
(...skipping 3205 matching lines...) Expand 10 before | Expand all | Expand 10 after
6114 int match_count, 6120 int match_count,
6115 int ordinal, 6121 int ordinal,
6116 const WebRect& selection_rect, 6122 const WebRect& selection_rect,
6117 bool final_status_update) { 6123 bool final_status_update) {
6118 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6124 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6119 selection_rect, ordinal, 6125 selection_rect, ordinal,
6120 final_status_update)); 6126 final_status_update));
6121 } 6127 }
6122 6128
6123 } // namespace content 6129 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | testing/buildbot/filters/browser-side-navigation.linux.browser_tests.filter » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698