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

Unified Diff: chrome/browser/captive_portal/captive_portal_tab_helper.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: chrome/browser/captive_portal/captive_portal_tab_helper.cc
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.cc b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
index 1e76e41359d1edb19097117f92e7cad68d043409..9bec18073a01e1728bcc57f30045e8dafb2d845e 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.cc
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
@@ -62,8 +62,7 @@ void CaptivePortalTabHelper::DidStartNavigation(
// and it committed (either the navigation proper or an error page), it is
// safe to start tracking the new navigation. Otherwise simulate an abort
// before reporting the start of the new navigation.
- if (navigation_handle_ && !navigation_handle_->HasCommittedDocument() &&
- !navigation_handle_->HasCommittedErrorPage()) {
+ if (navigation_handle_ && !navigation_handle_->HasCommitted()) {
tab_reloader_->OnAbort();
}
@@ -82,35 +81,35 @@ void CaptivePortalTabHelper::DidRedirectNavigation(
navigation_handle->GetURL().SchemeIsCryptographic());
}
-void CaptivePortalTabHelper::DidCommitNavigation(
+void CaptivePortalTabHelper::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
DCHECK(CalledOnValidThread());
if (!navigation_handle->IsInMainFrame())
return;
- if (navigation_handle_ != navigation_handle)
+ if (navigation_handle_ != navigation_handle) {
+ // Another navigation is being tracked, so there is no need to update the
+ // TabReloader.
+ if (!navigation_handle->HasCommitted())
+ return;
+ // An untracked navigation just committed. Simulate its start before
+ // informing the TabReloader of its commit.
DidStartNavigation(navigation_handle);
+ }
- tab_reloader_->OnLoadCommitted(navigation_handle->GetNetErrorCode());
-}
-
-void CaptivePortalTabHelper::DidFinishNavigation(
- content::NavigationHandle* navigation_handle) {
- DCHECK(CalledOnValidThread());
- if (navigation_handle != navigation_handle_)
- return;
- DCHECK(navigation_handle->IsInMainFrame());
-
- if (!navigation_handle->HasCommittedDocument() &&
- !navigation_handle->HasCommittedErrorPage()) {
+ if (navigation_handle->HasCommitted()) {
+ tab_reloader_->OnLoadCommitted(navigation_handle->GetNetErrorCode());
+ } else {
tab_reloader_->OnAbort();
}
- login_detector_->OnStoppedLoading();
-
navigation_handle_ = nullptr;
}
+void CaptivePortalTabHelper::DidStopLoading() {
+ login_detector_->OnStoppedLoading();
+}
+
void CaptivePortalTabHelper::Observe(
int type,
const content::NotificationSource& source,

Powered by Google App Engine
This is Rietveld 408576698