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

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

Issue 2394663002: Blimp: Propagating page loading status to tab (Closed)
Patch Set: dtrainor@ comments Created 4 years, 2 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/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 1dad91490f8f9a7ef446a422a1c4ee25131e2d72..a4456fb13df848fa5c903fed81d110848ed2cf21 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
@@ -206,6 +206,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
// Content layer Observers and Delegates
private ContentViewClient mContentViewClient;
private TabWebContentsObserver mWebContentsObserver;
+ private TabBlimpContentsObserver mBlimpContentsObserver;
private TabWebContentsDelegateAndroid mWebContentsDelegate;
private BlimpContents mBlimpContents;
@@ -1026,9 +1027,15 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* @return a value between 0 and 100 reflecting what percentage of the page load is complete.
*/
public int getProgress() {
- TabWebContentsDelegateAndroid delegate = getTabWebContentsDelegateAndroid();
- if (delegate == null) return 0;
- return isLoading() ? delegate.getMostRecentProgress() : 100;
+ if (!isLoading()) return 100;
+
+ if (mBlimp) {
+ return mBlimpContentsObserver != null ? mBlimpContentsObserver.getMostRecentProgress()
+ : 0;
+ } else {
+ TabWebContentsDelegateAndroid delegate = getTabWebContentsDelegateAndroid();
+ return delegate != null ? delegate.getMostRecentProgress() : 0;
+ }
}
/**
@@ -1471,7 +1478,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
mBlimpContents = nativeInitBlimpContents(
mNativeTabAndroid, profile, mWindowAndroid.getNativePointer());
if (mBlimpContents != null) {
- getBlimpContents().addObserver(new TabBlimpContentsObserver(this));
+ mBlimpContentsObserver = new TabBlimpContentsObserver(this);
+ mBlimpContents.addObserver(mBlimpContentsObserver);
} else {
mBlimp = false;
}
@@ -1880,6 +1888,18 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
}
/**
+ * Notify observers when provisional load starts.
+ * @param isMainFrame Whether the load is happening for the main frame.
+ * @param validatedUrl The validated URL that is being navigated to.
+ */
+ void handleDidStartProvisionalLoadForFrame(boolean isMainFrame, String validatedUrl) {
+ RewindableIterator<TabObserver> observers = getTabObservers();
+ while (observers.hasNext()) {
+ observers.next().onDidStartProvisionalLoadForFrame(this, isMainFrame, validatedUrl);
+ }
+ }
+
+ /**
* Update internal Tab state when provisional load gets committed.
* @param url The URL that was loaded.
* @param transitionType The transition type to the current URL.

Powered by Google App Engine
This is Rietveld 408576698