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

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

Issue 1976573002: Only use pending navigation params for browser-initiated navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: backward comment Created 4 years, 7 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 3548 matching lines...) Expand 10 before | Expand all | Expand 10 after
3559 } 3559 }
3560 3560
3561 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3561 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3562 DidFinishLoad(frame)); 3562 DidFinishLoad(frame));
3563 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad()); 3563 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishLoad());
3564 3564
3565 Send(new FrameHostMsg_DidFinishLoad(routing_id_, 3565 Send(new FrameHostMsg_DidFinishLoad(routing_id_,
3566 ds->request().url())); 3566 ds->request().url()));
3567 } 3567 }
3568 3568
3569 void RenderFrameImpl::didNavigateWithinPage(blink::WebLocalFrame* frame, 3569 void RenderFrameImpl::didNavigateWithinPage(
3570 blink::WebLocalFrame* frame,
3570 const blink::WebHistoryItem& item, 3571 const blink::WebHistoryItem& item,
3571 blink::WebHistoryCommitType commit_type) { 3572 blink::WebHistoryCommitType commit_type,
3573 bool content_initiated) {
3572 TRACE_EVENT1("navigation", "RenderFrameImpl::didNavigateWithinPage", 3574 TRACE_EVENT1("navigation", "RenderFrameImpl::didNavigateWithinPage",
3573 "id", routing_id_); 3575 "id", routing_id_);
3574 DCHECK_EQ(frame_, frame); 3576 DCHECK_EQ(frame_, frame);
3575 // If this was a reference fragment navigation that we initiated, then we 3577 // If this was a browser-initiated navigation, then there could be pending
3576 // could end up having a non-null pending navigation params. We just need to 3578 // navigation params, so use them. Otherwise, just reset the document state
3577 // update the ExtraData on the datasource so that others who read the 3579 // here, since if pending navigation params exist they are for some other
3578 // ExtraData will get the new NavigationState. Similarly, if we did not 3580 // navigation <https://crbug.com/597239>.
3579 // initiate this navigation, then we need to take care to reset any pre-
3580 // existing navigation state to a content-initiated navigation state.
3581 // UpdateNavigationState conveniently takes care of this for us.
3582 DocumentState* document_state = 3581 DocumentState* document_state =
3583 DocumentState::FromDataSource(frame->dataSource()); 3582 DocumentState::FromDataSource(frame->dataSource());
3584 UpdateNavigationState(document_state, true /* was_within_same_page */); 3583 if (content_initiated) {
Charlie Reis 2016/05/12 20:51:48 Would it be better to put this fix inside UpdateNa
Avi (use Gerrit) 2016/05/12 23:41:17 Right now we don't know if it's browser-initiated
Charlie Reis 2016/05/13 00:46:17 I could be ok leaving it as a TODO for this CL and
Avi (use Gerrit) 2016/05/13 01:35:44 It's probably not difficult to plumb it too. I'll
Avi (use Gerrit) 2016/05/13 16:45:19 FYI, at the beginning of RenderFrameImpl::didCreat
Charlie Reis 2016/05/13 18:26:55 Ha! Ok, yes, let's revisit that case (and any oth
3584 document_state->set_navigation_state(
3585 NavigationStateImpl::CreateContentInitiated());
3586 } else {
3587 UpdateNavigationState(document_state, true /* was_within_same_page */);
3588 }
3585 static_cast<NavigationStateImpl*>(document_state->navigation_state()) 3589 static_cast<NavigationStateImpl*>(document_state->navigation_state())
3586 ->set_was_within_same_page(true); 3590 ->set_was_within_same_page(true);
3587 3591
3588 didCommitProvisionalLoad(frame, item, commit_type); 3592 didCommitProvisionalLoad(frame, item, commit_type);
3589 } 3593 }
3590 3594
3591 void RenderFrameImpl::didUpdateCurrentHistoryItem() { 3595 void RenderFrameImpl::didUpdateCurrentHistoryItem() {
3592 render_view_->StartNavStateSyncTimerIfNecessary(this); 3596 render_view_->StartNavStateSyncTimerIfNecessary(this);
3593 } 3597 }
3594 3598
(...skipping 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after
6144 // event target. Potentially a Pepper plugin will receive the event. 6148 // event target. Potentially a Pepper plugin will receive the event.
6145 // In order to tell whether a plugin gets the last mouse event and which it 6149 // In order to tell whether a plugin gets the last mouse event and which it
6146 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6150 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6147 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6151 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6148 // |pepper_last_mouse_event_target_|. 6152 // |pepper_last_mouse_event_target_|.
6149 pepper_last_mouse_event_target_ = nullptr; 6153 pepper_last_mouse_event_target_ = nullptr;
6150 #endif 6154 #endif
6151 } 6155 }
6152 6156
6153 } // namespace content 6157 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698