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

Unified Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 1350673003: Remove WebContentsObserver::DidCommitNavigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 2c5e773cace4de12b361e5a6032121f782f21834..402e794e635226cf3b3499540988bd098499eb6e 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -25,6 +25,7 @@ NavigationHandleImpl::NavigationHandleImpl(const GURL& url,
net_error_code_(net::OK),
state_(DID_START),
is_main_frame_(is_main_frame),
+ render_frame_host_(nullptr),
is_same_page_(false),
is_transferring_(false),
delegate_(delegate) {
@@ -47,6 +48,13 @@ bool NavigationHandleImpl::IsInMainFrame() const {
return is_main_frame_;
}
+RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() {
+ CHECK(state_ >= READY_TO_COMMIT)
+ << "This accessor should only be called "
+ "after the navigation is ready to commit.";
+ return render_frame_host_;
+}
+
bool NavigationHandleImpl::IsSamePage() {
DCHECK(state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE)
<< "This accessor should not be called before the navigation has "
@@ -54,11 +62,11 @@ bool NavigationHandleImpl::IsSamePage() {
return is_same_page_;
}
-bool NavigationHandleImpl::HasCommittedDocument() const {
- return state_ == DID_COMMIT;
+bool NavigationHandleImpl::HasCommitted() {
+ return state_ == DID_COMMIT || state_ == DID_COMMIT_ERROR_PAGE;
}
-bool NavigationHandleImpl::HasCommittedErrorPage() const {
+bool NavigationHandleImpl::IsErrorPage() {
return state_ == DID_COMMIT_ERROR_PAGE;
}
@@ -67,10 +75,21 @@ void NavigationHandleImpl::DidRedirectNavigation(const GURL& new_url) {
delegate_->DidRedirectNavigation(this);
}
-void NavigationHandleImpl::DidCommitNavigation(bool same_page) {
+void NavigationHandleImpl::ReadyToCommitNavigation(
+ RenderFrameHostImpl* render_frame_host) {
+ CHECK(!render_frame_host_);
+ render_frame_host_ = render_frame_host;
+ state_ = READY_TO_COMMIT;
+ delegate_->ReadyToCommitNavigation(this);
+}
+
+void NavigationHandleImpl::DidCommitNavigation(
+ bool same_page,
+ RenderFrameHostImpl* render_frame_host) {
+ CHECK_IMPLIES(render_frame_host_, render_frame_host_ == render_frame_host);
is_same_page_ = same_page;
+ render_frame_host_ = render_frame_host;
state_ = net_error_code_ == net::OK ? DID_COMMIT : DID_COMMIT_ERROR_PAGE;
- delegate_->DidCommitNavigation(this);
}
} // namespace content
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.h ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698