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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/android/java/src/org/chromium/chrome/browser/tab/Tab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
index fed11c8825a486df65c836a4a7e993ee1b590359..27e6965d9e18f4d240257d497458392427ce0684 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -1395,6 +1395,26 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
}
/**
+ * Called when a navigation begins and no navigation was in progress
+ * @param toDifferentDocument Whether this navigation will transition between
+ * documents (i.e., not a fragment navigation or JS History API call).
+ */
+ protected void onLoadStarted(boolean toDifferentDocument) {
+ if (toDifferentDocument) mIsLoading = true;
+ for (TabObserver observer : mObservers) observer.onLoadStarted(this, toDifferentDocument);
+ }
+
+ /**
+ * Called when a navigation completes and no other navigation is in progress.
+ */
+ protected void onLoadStopped() {
+ // mIsLoading should only be false if this is a same-document navigation.
+ boolean toDifferentDocument = mIsLoading;
+ mIsLoading = false;
+ for (TabObserver observer : mObservers) observer.onLoadStopped(this, toDifferentDocument);
+ }
+
+ /**
* Called when a page has started loading.
* @param validatedUrl URL being loaded.
* @param showingErrorPage Whether an error page is being shown.
@@ -1403,7 +1423,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
mIsFullscreenWaitingForLoad = !DomDistillerUrlUtils.isDistilledPage(validatedUrl);
mIsShowingErrorPage = showingErrorPage;
- mIsLoading = true;
updateTitle();
removeSadTabIfPresent();
@@ -1417,7 +1436,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* Called when a page has finished loading.
*/
protected void didFinishPageLoad() {
- mIsLoading = false;
mIsBeingRestored = false;
mIsTabStateDirty = true;
updateTitle();
@@ -1450,7 +1468,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
*/
protected void didFailPageLoad(int errorCode) {
cancelEnableFullscreenLoadDelay();
- mIsLoading = false;
mIsBeingRestored = false;
if (mTabUma != null) mTabUma.onLoadFailed(errorCode);
for (TabObserver observer : mObservers) observer.onPageLoadFailed(this, errorCode);

Powered by Google App Engine
This is Rietveld 408576698