| Index: chrome/android/java/src/org/chromium/chrome/browser/tab/TabBlimpContentsObserver.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabBlimpContentsObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabBlimpContentsObserver.java
|
| index 07b7e1963f920444614dbb1f62db97d7264ac6c0..38203177465a7f6e7a10bf2cd70267596b2490c8 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabBlimpContentsObserver.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabBlimpContentsObserver.java
|
| @@ -13,9 +13,11 @@ import org.chromium.ui.base.PageTransition;
|
| */
|
| public class TabBlimpContentsObserver extends EmptyBlimpContentsObserver {
|
| private Tab mTab;
|
| + private boolean mPageIsLoading;
|
|
|
| public TabBlimpContentsObserver(Tab tab) {
|
| mTab = tab;
|
| + mPageIsLoading = false;
|
| }
|
|
|
| /**
|
| @@ -32,11 +34,47 @@ public class TabBlimpContentsObserver extends EmptyBlimpContentsObserver {
|
|
|
| /**
|
| * Tab can use this to drive what kind of content to show based on the URL.
|
| + * Also sets the loading status of the tab correctly.
|
| */
|
| @Override
|
| public void onLoadingStateChanged(boolean loading) {
|
| - // TODO(dtrainor): Investigate if we need to pipe through a more accurate PageTransition
|
| - // here.
|
| - mTab.handleDidCommitProvisonalLoadForFrame(mTab.getUrl(), PageTransition.TYPED);
|
| + if (loading) {
|
| + // Passing true for toDifferentDocument to update visuals related to location bar.
|
| + mTab.onLoadStarted(true);
|
| + } else {
|
| + mTab.onLoadStopped();
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * This method is used to update the status of progress bar.
|
| + */
|
| + @Override
|
| + public void onPageLoadingStateChanged(boolean loading) {
|
| + mPageIsLoading = loading;
|
| + if (loading) {
|
| + mTab.didStartPageLoad(mTab.getUrl(), false);
|
| +
|
| + // Simulate provisional load start and completion events.
|
| + mTab.handleDidStartProvisionalLoadForFrame(true, mTab.getUrl());
|
| +
|
| + // TODO(dtrainor): Investigate if we need to pipe through a more accurate PageTransition
|
| + // here.
|
| + mTab.handleDidCommitProvisonalLoadForFrame(mTab.getUrl(), PageTransition.TYPED);
|
| +
|
| + // Currently, blimp doesn't have a way to calculate the progress. So we are sending a
|
| + // fake progress value.
|
| + mTab.notifyLoadProgress(30);
|
| + } else {
|
| + mTab.notifyLoadProgress(100);
|
| + mTab.didFinishPageLoad();
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * @return a value between 0 and 100 reflecting what percentage of the page load is complete.
|
| + */
|
| + public int getMostRecentProgress() {
|
| + return mPageIsLoading ? 30 : 100;
|
| }
|
| }
|
|
|