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

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

Issue 2735183003: PlzNavigate: stop navigations when opening a document for write (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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) 1564 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
1565 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) 1565 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags)
1566 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, 1566 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1567 OnSetFrameOwnerProperties) 1567 OnSetFrameOwnerProperties)
1568 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) 1568 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus)
1569 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) 1569 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame)
1570 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1570 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1571 OnTextTrackSettingsChanged) 1571 OnTextTrackSettingsChanged)
1572 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1572 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1573 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1573 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1574 IPC_MESSAGE_HANDLER(FrameMsg_DroppedNavigation, OnDroppedNavigation)
1574 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1575 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1575 OnGetSavableResourceLinks) 1576 OnGetSavableResourceLinks)
1576 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1577 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1577 OnGetSerializedHtmlWithLocalLinks) 1578 OnGetSerializedHtmlWithLocalLinks)
1578 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) 1579 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML)
1579 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) 1580 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind)
1580 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) 1581 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch)
1581 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) 1582 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding)
1582 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1583 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1583 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, 1584 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs,
(...skipping 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after
4046 4047
4047 void RenderFrameImpl::dispatchLoad() { 4048 void RenderFrameImpl::dispatchLoad() {
4048 Send(new FrameHostMsg_DispatchLoad(routing_id_)); 4049 Send(new FrameHostMsg_DispatchLoad(routing_id_));
4049 } 4050 }
4050 4051
4051 blink::WebEffectiveConnectionType 4052 blink::WebEffectiveConnectionType
4052 RenderFrameImpl::getEffectiveConnectionType() { 4053 RenderFrameImpl::getEffectiveConnectionType() {
4053 return effective_connection_type_; 4054 return effective_connection_type_;
4054 } 4055 }
4055 4056
4057 void RenderFrameImpl::abortClientNavigation() {
4058 Send(new FrameHostMsg_AbortNavigation(routing_id_));
4059 }
4060
4056 void RenderFrameImpl::didChangeSelection(bool is_empty_selection) { 4061 void RenderFrameImpl::didChangeSelection(bool is_empty_selection) {
4057 if (!GetRenderWidget()->input_handler().handling_input_event() && 4062 if (!GetRenderWidget()->input_handler().handling_input_event() &&
4058 !handling_select_range_) 4063 !handling_select_range_)
4059 return; 4064 return;
4060 4065
4061 if (is_empty_selection) 4066 if (is_empty_selection)
4062 selection_text_.clear(); 4067 selection_text_.clear();
4063 4068
4064 // UpdateTextInputState should be called before SyncSelectionIfRequired. 4069 // UpdateTextInputState should be called before SyncSelectionIfRequired.
4065 // UpdateTextInputState may send TextInputStateChanged to notify the focus 4070 // UpdateTextInputState may send TextInputStateChanged to notify the focus
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5254 // provisionalDataSource(), LoadNavigationErrorPage wasn't called, so do it 5259 // provisionalDataSource(), LoadNavigationErrorPage wasn't called, so do it
5255 // now. 5260 // now.
5256 if (request_params.nav_entry_id != 0 || !had_provisional_data_source) { 5261 if (request_params.nav_entry_id != 0 || !had_provisional_data_source) {
5257 LoadNavigationErrorPage(failed_request, error, replace, 5262 LoadNavigationErrorPage(failed_request, error, replace,
5258 history_entry.get()); 5263 history_entry.get());
5259 } 5264 }
5260 5265
5261 browser_side_navigation_pending_ = false; 5266 browser_side_navigation_pending_ = false;
5262 } 5267 }
5263 5268
5269 void RenderFrameImpl::OnDroppedNavigation(int navigation_id) {
5270 // Check that the navigation dropped was the last one sent to the browser
5271 // process. If not, do nothing as the browser process still has some more
5272 // navigations to process.
5273 if (navigation_id != navigation_id_)
5274 return;
5275 browser_side_navigation_pending_ = false;
5276 frame_->clientDroppedNavigation();
5277 }
5278
5264 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( 5279 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
5265 const NavigationPolicyInfo& info) { 5280 const NavigationPolicyInfo& info) {
5266 // A content initiated navigation may have originated from a link-click, 5281 // A content initiated navigation may have originated from a link-click,
5267 // script, drag-n-drop operation, etc. 5282 // script, drag-n-drop operation, etc.
5268 // info.extraData is only non-null if this is a redirect. Use the extraData 5283 // info.extraData is only non-null if this is a redirect. Use the extraData
5269 // initiation information for redirects, and check pending_navigation_params_ 5284 // initiation information for redirects, and check pending_navigation_params_
5270 // otherwise. 5285 // otherwise.
5271 bool is_content_initiated = 5286 bool is_content_initiated =
5272 info.extraData 5287 info.extraData
5273 ? static_cast<DocumentState*>(info.extraData) 5288 ? static_cast<DocumentState*>(info.extraData)
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
6327 net::LOAD_ONLY_FROM_CACHE | net::LOAD_DISABLE_CACHE); 6342 net::LOAD_ONLY_FROM_CACHE | net::LOAD_DISABLE_CACHE);
6328 load_flags |= net::LOAD_BYPASS_CACHE; 6343 load_flags |= net::LOAD_BYPASS_CACHE;
6329 } 6344 }
6330 BeginNavigationParams begin_navigation_params( 6345 BeginNavigationParams begin_navigation_params(
6331 GetWebURLRequestHeaders(info.urlRequest), load_flags, 6346 GetWebURLRequestHeaders(info.urlRequest), load_flags,
6332 info.urlRequest.hasUserGesture(), 6347 info.urlRequest.hasUserGesture(),
6333 info.urlRequest.getServiceWorkerMode() != 6348 info.urlRequest.getServiceWorkerMode() !=
6334 blink::WebURLRequest::ServiceWorkerMode::All, 6349 blink::WebURLRequest::ServiceWorkerMode::All,
6335 GetRequestContextTypeForWebURLRequest(info.urlRequest), 6350 GetRequestContextTypeForWebURLRequest(info.urlRequest),
6336 GetMixedContentContextTypeForWebURLRequest(info.urlRequest), 6351 GetMixedContentContextTypeForWebURLRequest(info.urlRequest),
6337 initiator_origin); 6352 initiator_origin, ++navigation_id_);
6338 6353
6339 if (!info.form.isNull()) { 6354 if (!info.form.isNull()) {
6340 WebSearchableFormData web_searchable_form_data(info.form); 6355 WebSearchableFormData web_searchable_form_data(info.form);
6341 begin_navigation_params.searchable_form_url = 6356 begin_navigation_params.searchable_form_url =
6342 web_searchable_form_data.url(); 6357 web_searchable_form_data.url();
6343 begin_navigation_params.searchable_form_encoding = 6358 begin_navigation_params.searchable_form_encoding =
6344 web_searchable_form_data.encoding().utf8(); 6359 web_searchable_form_data.encoding().utf8();
6345 } 6360 }
6346 6361
6347 if (info.isClientRedirect) 6362 if (info.isClientRedirect)
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
6893 // event target. Potentially a Pepper plugin will receive the event. 6908 // 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 6909 // 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 6910 // 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 6911 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6897 // |pepper_last_mouse_event_target_|. 6912 // |pepper_last_mouse_event_target_|.
6898 pepper_last_mouse_event_target_ = nullptr; 6913 pepper_last_mouse_event_target_ = nullptr;
6899 #endif 6914 #endif
6900 } 6915 }
6901 6916
6902 } // namespace content 6917 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698