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

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

Issue 839413004: Remove the use of page id from building the commit params. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl try Created 5 years, 10 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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 } 2580 }
2581 } 2581 }
2582 2582
2583 // Remember that we've already processed this request, so we don't update 2583 // Remember that we've already processed this request, so we don't update
2584 // the session history again. We do this regardless of whether this is 2584 // the session history again. We do this regardless of whether this is
2585 // a session history navigation, because if we attempted a session history 2585 // a session history navigation, because if we attempted a session history
2586 // navigation without valid HistoryItem state, WebCore will think it is a 2586 // navigation without valid HistoryItem state, WebCore will think it is a
2587 // new navigation. 2587 // new navigation.
2588 navigation_state->set_request_committed(true); 2588 navigation_state->set_request_committed(true);
2589 2589
2590 SendDidCommitProvisionalLoad(frame); 2590 SendDidCommitProvisionalLoad(frame, commit_type);
2591 2591
2592 // Check whether we have new encoding name. 2592 // Check whether we have new encoding name.
2593 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 2593 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
2594 } 2594 }
2595 2595
2596 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) { 2596 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) {
2597 DCHECK(!frame_ || frame_ == frame); 2597 DCHECK(!frame_ || frame_ == frame);
2598 2598
2599 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2599 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2600 DidCreateNewDocument(frame)); 2600 DidCreateNewDocument(frame));
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
3654 blink::WebPageVisibilityStateVisible, false); 3654 blink::WebPageVisibilityStateVisible, false);
3655 } 3655 }
3656 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown()); 3656 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown());
3657 } 3657 }
3658 3658
3659 bool RenderFrameImpl::IsHidden() { 3659 bool RenderFrameImpl::IsHidden() {
3660 return GetRenderWidget()->is_hidden(); 3660 return GetRenderWidget()->is_hidden();
3661 } 3661 }
3662 3662
3663 // Tell the embedding application that the URL of the active page has changed. 3663 // Tell the embedding application that the URL of the active page has changed.
3664 void RenderFrameImpl::SendDidCommitProvisionalLoad(blink::WebFrame* frame) { 3664 void RenderFrameImpl::SendDidCommitProvisionalLoad(
3665 blink::WebFrame* frame,
3666 blink::WebHistoryCommitType commit_type) {
3665 DCHECK(!frame_ || frame_ == frame); 3667 DCHECK(!frame_ || frame_ == frame);
3666 WebDataSource* ds = frame->dataSource(); 3668 WebDataSource* ds = frame->dataSource();
3667 DCHECK(ds); 3669 DCHECK(ds);
3668 3670
3669 const WebURLRequest& request = ds->request(); 3671 const WebURLRequest& request = ds->request();
3670 const WebURLResponse& response = ds->response(); 3672 const WebURLResponse& response = ds->response();
3671 3673
3672 DocumentState* document_state = DocumentState::FromDataSource(ds); 3674 DocumentState* document_state = DocumentState::FromDataSource(ds);
3673 NavigationState* navigation_state = document_state->navigation_state(); 3675 NavigationState* navigation_state = document_state->navigation_state();
3674 InternalDocumentStateData* internal_data = 3676 InternalDocumentStateData* internal_data =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 params.should_update_history = !ds->hasUnreachableURL() && 3719 params.should_update_history = !ds->hasUnreachableURL() &&
3718 !response.isMultipartPayload() && (response.httpStatusCode() != 404); 3720 !response.isMultipartPayload() && (response.httpStatusCode() != 404);
3719 3721
3720 params.searchable_form_url = internal_data->searchable_form_url(); 3722 params.searchable_form_url = internal_data->searchable_form_url();
3721 params.searchable_form_encoding = internal_data->searchable_form_encoding(); 3723 params.searchable_form_encoding = internal_data->searchable_form_encoding();
3722 3724
3723 params.gesture = render_view_->navigation_gesture_; 3725 params.gesture = render_view_->navigation_gesture_;
3724 render_view_->navigation_gesture_ = NavigationGestureUnknown; 3726 render_view_->navigation_gesture_ = NavigationGestureUnknown;
3725 3727
3726 // Make navigation state a part of the DidCommitProvisionalLoad message so 3728 // Make navigation state a part of the DidCommitProvisionalLoad message so
3727 // that commited entry has it at all times. 3729 // that committed entry has it at all times.
3728 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry(); 3730 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry();
3729 if (entry) 3731 if (entry)
3730 params.page_state = HistoryEntryToPageState(entry); 3732 params.page_state = HistoryEntryToPageState(entry);
3731 else 3733 else
3732 params.page_state = PageState::CreateFromURL(request.url()); 3734 params.page_state = PageState::CreateFromURL(request.url());
3733 3735
3734 if (!frame->parent()) { 3736 if (!frame->parent()) {
3735 // Top-level navigation. 3737 // Top-level navigation.
3736 3738
3737 // Reset the zoom limits in case a plugin had changed them previously. This 3739 // Reset the zoom limits in case a plugin had changed them previously. This
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3822 3824
3823 // This message needs to be sent before any of allowScripts(), 3825 // This message needs to be sent before any of allowScripts(),
3824 // allowImages(), allowPlugins() is called for the new page, so that when 3826 // allowImages(), allowPlugins() is called for the new page, so that when
3825 // these functions send a ViewHostMsg_ContentBlocked message, it arrives 3827 // these functions send a ViewHostMsg_ContentBlocked message, it arrives
3826 // after the FrameHostMsg_DidCommitProvisionalLoad message. 3828 // after the FrameHostMsg_DidCommitProvisionalLoad message.
3827 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); 3829 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params));
3828 } else { 3830 } else {
3829 // Subframe navigation: the type depends on whether this navigation 3831 // Subframe navigation: the type depends on whether this navigation
3830 // generated a new session history entry. When they do generate a session 3832 // generated a new session history entry. When they do generate a session
3831 // history entry, it means the user initiated the navigation and we should 3833 // history entry, it means the user initiated the navigation and we should
3832 // mark it as such. This test checks if this is the first time 3834 // mark it as such.
3833 // SendDidCommitProvisionalLoad has been called since WillNavigateToURL was 3835 bool is_history_navigation = commit_type == blink::WebBackForwardCommit;
3834 // called to initiate the load. 3836 if (is_history_navigation || ds->replacesCurrentHistoryItem())
3835 if (render_view_->page_id_ > render_view_->last_page_id_sent_to_browser_) 3837 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME;
3838 else
3836 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; 3839 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME;
3837 else
3838 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME;
3839 3840
3840 DCHECK(!navigation_state->history_list_was_cleared()); 3841 DCHECK(!navigation_state->history_list_was_cleared());
3841 params.history_list_was_cleared = false; 3842 params.history_list_was_cleared = false;
3842 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT; 3843 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT;
3843 3844
3844 // Don't send this message while the subframe is swapped out. 3845 // Don't send this message while the subframe is swapped out.
3845 if (!is_swapped_out()) 3846 if (!is_swapped_out())
3846 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); 3847 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params));
3847 } 3848 }
3848 3849
3849 render_view_->last_page_id_sent_to_browser_ =
3850 std::max(render_view_->last_page_id_sent_to_browser_,
3851 render_view_->page_id_);
3852
3853 // If we end up reusing this WebRequest (for example, due to a #ref click), 3850 // If we end up reusing this WebRequest (for example, due to a #ref click),
3854 // we don't want the transition type to persist. Just clear it. 3851 // we don't want the transition type to persist. Just clear it.
3855 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK); 3852 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK);
3856 } 3853 }
3857 3854
3858 void RenderFrameImpl::didStartLoading(bool to_different_document) { 3855 void RenderFrameImpl::didStartLoading(bool to_different_document) {
3859 TRACE_EVENT1("navigation", "RenderFrameImpl::didStartLoading", 3856 TRACE_EVENT1("navigation", "RenderFrameImpl::didStartLoading",
3860 "id", routing_id_); 3857 "id", routing_id_);
3861 render_view_->FrameDidStartLoading(frame_); 3858 render_view_->FrameDidStartLoading(frame_);
3862 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document)); 3859 Send(new FrameHostMsg_DidStartLoading(routing_id_, to_different_document));
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
4477 4474
4478 #if defined(ENABLE_BROWSER_CDMS) 4475 #if defined(ENABLE_BROWSER_CDMS)
4479 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4476 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4480 if (!cdm_manager_) 4477 if (!cdm_manager_)
4481 cdm_manager_ = new RendererCdmManager(this); 4478 cdm_manager_ = new RendererCdmManager(this);
4482 return cdm_manager_; 4479 return cdm_manager_;
4483 } 4480 }
4484 #endif // defined(ENABLE_BROWSER_CDMS) 4481 #endif // defined(ENABLE_BROWSER_CDMS)
4485 4482
4486 } // namespace content 4483 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698