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

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

Issue 867963002: Revert of Remove the use of page id from building the commit params. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_impl.h » ('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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 } 2522 }
2523 } 2523 }
2524 2524
2525 // Remember that we've already processed this request, so we don't update 2525 // Remember that we've already processed this request, so we don't update
2526 // the session history again. We do this regardless of whether this is 2526 // the session history again. We do this regardless of whether this is
2527 // a session history navigation, because if we attempted a session history 2527 // a session history navigation, because if we attempted a session history
2528 // navigation without valid HistoryItem state, WebCore will think it is a 2528 // navigation without valid HistoryItem state, WebCore will think it is a
2529 // new navigation. 2529 // new navigation.
2530 navigation_state->set_request_committed(true); 2530 navigation_state->set_request_committed(true);
2531 2531
2532 SendDidCommitProvisionalLoad(frame, commit_type); 2532 SendDidCommitProvisionalLoad(frame);
2533 2533
2534 // Check whether we have new encoding name. 2534 // Check whether we have new encoding name.
2535 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 2535 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
2536 } 2536 }
2537 2537
2538 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) { 2538 void RenderFrameImpl::didCreateNewDocument(blink::WebLocalFrame* frame) {
2539 DCHECK(!frame_ || frame_ == frame); 2539 DCHECK(!frame_ || frame_ == frame);
2540 2540
2541 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2541 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2542 DidCreateNewDocument(frame)); 2542 DidCreateNewDocument(frame));
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 3570
3571 void RenderFrameImpl::WasShown() { 3571 void RenderFrameImpl::WasShown() {
3572 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown()); 3572 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown());
3573 } 3573 }
3574 3574
3575 bool RenderFrameImpl::IsHidden() { 3575 bool RenderFrameImpl::IsHidden() {
3576 return GetRenderWidget()->is_hidden(); 3576 return GetRenderWidget()->is_hidden();
3577 } 3577 }
3578 3578
3579 // Tell the embedding application that the URL of the active page has changed. 3579 // Tell the embedding application that the URL of the active page has changed.
3580 void RenderFrameImpl::SendDidCommitProvisionalLoad( 3580 void RenderFrameImpl::SendDidCommitProvisionalLoad(blink::WebFrame* frame) {
3581 blink::WebFrame* frame,
3582 blink::WebHistoryCommitType commit_type) {
3583 DCHECK(!frame_ || frame_ == frame); 3581 DCHECK(!frame_ || frame_ == frame);
3584 WebDataSource* ds = frame->dataSource(); 3582 WebDataSource* ds = frame->dataSource();
3585 DCHECK(ds); 3583 DCHECK(ds);
3586 3584
3587 const WebURLRequest& request = ds->request(); 3585 const WebURLRequest& request = ds->request();
3588 const WebURLResponse& response = ds->response(); 3586 const WebURLResponse& response = ds->response();
3589 3587
3590 DocumentState* document_state = DocumentState::FromDataSource(ds); 3588 DocumentState* document_state = DocumentState::FromDataSource(ds);
3591 NavigationState* navigation_state = document_state->navigation_state(); 3589 NavigationState* navigation_state = document_state->navigation_state();
3592 InternalDocumentStateData* internal_data = 3590 InternalDocumentStateData* internal_data =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3635 params.should_update_history = !ds->hasUnreachableURL() && 3633 params.should_update_history = !ds->hasUnreachableURL() &&
3636 !response.isMultipartPayload() && (response.httpStatusCode() != 404); 3634 !response.isMultipartPayload() && (response.httpStatusCode() != 404);
3637 3635
3638 params.searchable_form_url = internal_data->searchable_form_url(); 3636 params.searchable_form_url = internal_data->searchable_form_url();
3639 params.searchable_form_encoding = internal_data->searchable_form_encoding(); 3637 params.searchable_form_encoding = internal_data->searchable_form_encoding();
3640 3638
3641 params.gesture = render_view_->navigation_gesture_; 3639 params.gesture = render_view_->navigation_gesture_;
3642 render_view_->navigation_gesture_ = NavigationGestureUnknown; 3640 render_view_->navigation_gesture_ = NavigationGestureUnknown;
3643 3641
3644 // Make navigation state a part of the DidCommitProvisionalLoad message so 3642 // Make navigation state a part of the DidCommitProvisionalLoad message so
3645 // that committed entry has it at all times. 3643 // that commited entry has it at all times.
3646 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry(); 3644 HistoryEntry* entry = render_view_->history_controller()->GetCurrentEntry();
3647 if (entry) 3645 if (entry)
3648 params.page_state = HistoryEntryToPageState(entry); 3646 params.page_state = HistoryEntryToPageState(entry);
3649 else 3647 else
3650 params.page_state = PageState::CreateFromURL(request.url()); 3648 params.page_state = PageState::CreateFromURL(request.url());
3651 3649
3652 if (!frame->parent()) { 3650 if (!frame->parent()) {
3653 // Top-level navigation. 3651 // Top-level navigation.
3654 3652
3655 // Reset the zoom limits in case a plugin had changed them previously. This 3653 // 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
3740 3738
3741 // This message needs to be sent before any of allowScripts(), 3739 // This message needs to be sent before any of allowScripts(),
3742 // allowImages(), allowPlugins() is called for the new page, so that when 3740 // allowImages(), allowPlugins() is called for the new page, so that when
3743 // these functions send a ViewHostMsg_ContentBlocked message, it arrives 3741 // these functions send a ViewHostMsg_ContentBlocked message, it arrives
3744 // after the FrameHostMsg_DidCommitProvisionalLoad message. 3742 // after the FrameHostMsg_DidCommitProvisionalLoad message.
3745 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); 3743 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params));
3746 } else { 3744 } else {
3747 // Subframe navigation: the type depends on whether this navigation 3745 // Subframe navigation: the type depends on whether this navigation
3748 // generated a new session history entry. When they do generate a session 3746 // generated a new session history entry. When they do generate a session
3749 // history entry, it means the user initiated the navigation and we should 3747 // history entry, it means the user initiated the navigation and we should
3750 // mark it as such. 3748 // mark it as such. This test checks if this is the first time
3751 bool is_history_navigation = commit_type == blink::WebBackForwardCommit; 3749 // SendDidCommitProvisionalLoad has been called since WillNavigateToURL was
3752 if (is_history_navigation || ds->replacesCurrentHistoryItem()) 3750 // called to initiate the load.
3751 if (render_view_->page_id_ > render_view_->last_page_id_sent_to_browser_)
3752 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME;
3753 else
3753 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; 3754 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME;
3754 else
3755 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME;
3756 3755
3757 DCHECK(!navigation_state->history_list_was_cleared()); 3756 DCHECK(!navigation_state->history_list_was_cleared());
3758 params.history_list_was_cleared = false; 3757 params.history_list_was_cleared = false;
3759 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT; 3758 params.report_type = FrameMsg_UILoadMetricsReportType::NO_REPORT;
3760 3759
3761 // Don't send this message while the subframe is swapped out. 3760 // Don't send this message while the subframe is swapped out.
3762 if (!is_swapped_out()) 3761 if (!is_swapped_out())
3763 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params)); 3762 Send(new FrameHostMsg_DidCommitProvisionalLoad(routing_id_, params));
3764 } 3763 }
3765 3764
3765 render_view_->last_page_id_sent_to_browser_ =
3766 std::max(render_view_->last_page_id_sent_to_browser_,
3767 render_view_->page_id_);
3768
3766 // If we end up reusing this WebRequest (for example, due to a #ref click), 3769 // If we end up reusing this WebRequest (for example, due to a #ref click),
3767 // we don't want the transition type to persist. Just clear it. 3770 // we don't want the transition type to persist. Just clear it.
3768 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK); 3771 navigation_state->set_transition_type(ui::PAGE_TRANSITION_LINK);
3769 } 3772 }
3770 3773
3771 WebElement RenderFrameImpl::GetFocusedElement() { 3774 WebElement RenderFrameImpl::GetFocusedElement() {
3772 WebDocument doc = frame_->document(); 3775 WebDocument doc = frame_->document();
3773 if (!doc.isNull()) 3776 if (!doc.isNull())
3774 return doc.focusedElement(); 3777 return doc.focusedElement();
3775 3778
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 4394
4392 #if defined(ENABLE_BROWSER_CDMS) 4395 #if defined(ENABLE_BROWSER_CDMS)
4393 RendererCdmManager* RenderFrameImpl::GetCdmManager() { 4396 RendererCdmManager* RenderFrameImpl::GetCdmManager() {
4394 if (!cdm_manager_) 4397 if (!cdm_manager_)
4395 cdm_manager_ = new RendererCdmManager(this); 4398 cdm_manager_ = new RendererCdmManager(this);
4396 return cdm_manager_; 4399 return cdm_manager_;
4397 } 4400 }
4398 #endif // defined(ENABLE_BROWSER_CDMS) 4401 #endif // defined(ENABLE_BROWSER_CDMS)
4399 4402
4400 } // namespace content 4403 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698