Index: chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
index f37975a9b67e0b074c068c7d85c5221f7af90ac9..a3ab6d981d35ccc69290ff1825812598773c182d 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
@@ -214,12 +214,12 @@ public class Tab implements NavigationClient { |
new Runnable() { |
@Override |
public void run() { |
- contentViewCore.cancelPendingReload(); |
+ getWebContents().getNavigationController().cancelPendingReload(); |
} |
}, new Runnable() { |
@Override |
public void run() { |
- contentViewCore.continuePendingReload(); |
+ getWebContents().getNavigationController().continuePendingReload(); |
} |
}); |
Activity activity = (Activity) mContext; |
@@ -363,34 +363,36 @@ public class Tab implements NavigationClient { |
* @return Whether or not this tab has a previous navigation entry. |
*/ |
public boolean canGoBack() { |
- return mContentViewCore != null && mContentViewCore.canGoBack(); |
+ return getWebContents() != null && getWebContents().getNavigationController().canGoBack(); |
} |
/** |
* @return Whether or not this tab has a navigation entry after the current one. |
*/ |
public boolean canGoForward() { |
- return mContentViewCore != null && mContentViewCore.canGoForward(); |
+ return getWebContents() != null && getWebContents().getNavigationController() |
+ .canGoForward(); |
} |
/** |
* Goes to the navigation entry before the current one. |
*/ |
public void goBack() { |
- if (mContentViewCore != null) mContentViewCore.goBack(); |
+ if (getWebContents() != null) getWebContents().getNavigationController().goBack(); |
} |
/** |
* Goes to the navigation entry after the current one. |
*/ |
public void goForward() { |
- if (mContentViewCore != null) mContentViewCore.goForward(); |
+ if (getWebContents() != null) getWebContents().getNavigationController().goForward(); |
} |
@Override |
public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) { |
- if (mContentViewCore != null) { |
- return mContentViewCore.getDirectedNavigationHistory(isForward, itemLimit); |
+ if (getWebContents() != null) { |
+ return getWebContents().getNavigationController() |
+ .getDirectedNavigationHistory(isForward, itemLimit); |
} else { |
return new NavigationHistory(); |
} |
@@ -398,21 +400,25 @@ public class Tab implements NavigationClient { |
@Override |
public void goToNavigationIndex(int index) { |
- if (mContentViewCore != null) mContentViewCore.goToNavigationIndex(index); |
+ if (getWebContents() != null) { |
+ getWebContents().getNavigationController().goToNavigationIndex(index); |
+ } |
} |
/** |
* Loads the current navigation if there is a pending lazy load (after tab restore). |
*/ |
public void loadIfNecessary() { |
- if (mContentViewCore != null) mContentViewCore.loadIfNecessary(); |
+ if (getWebContents() != null) getWebContents().getNavigationController().loadIfNecessary(); |
} |
/** |
* Requests the current navigation to be loaded upon the next call to loadIfNecessary(). |
*/ |
protected void requestRestoreLoad() { |
- if (mContentViewCore != null) mContentViewCore.requestRestoreLoad(); |
+ if (getWebContents() != null) { |
+ getWebContents().getNavigationController().requestRestoreLoad(); |
+ } |
} |
/** |
@@ -454,8 +460,7 @@ public class Tab implements NavigationClient { |
* a bad HTTPS page. |
*/ |
public boolean isShowingInterstitialPage() { |
- ContentViewCore contentViewCore = getContentViewCore(); |
- return contentViewCore != null && contentViewCore.isShowingInterstitialPage(); |
+ return getWebContents() != null && getWebContents().isShowingInterstitialPage(); |
} |
/** |
@@ -533,7 +538,7 @@ public class Tab implements NavigationClient { |
*/ |
public void reload() { |
// TODO(dtrainor): Should we try to rebuild the ContentView if it's frozen? |
- if (mContentViewCore != null) mContentViewCore.reload(true); |
+ if (getWebContents() != null) getWebContents().getNavigationController().reload(true); |
} |
/** |
@@ -541,12 +546,14 @@ public class Tab implements NavigationClient { |
* This version ignores the cache and reloads from the network. |
*/ |
public void reloadIgnoringCache() { |
- if (mContentViewCore != null) mContentViewCore.reloadIgnoringCache(true); |
+ if (getWebContents() != null) { |
+ getWebContents().getNavigationController().reloadIgnoringCache(true); |
+ } |
} |
/** Stop the current navigation. */ |
public void stopLoading() { |
- if (mContentViewCore != null) mContentViewCore.stopLoading(); |
+ if (getWebContents() != null) getWebContents().stop(); |
} |
/** |
@@ -554,7 +561,7 @@ public class Tab implements NavigationClient { |
*/ |
public int getBackgroundColor() { |
if (mNativePage != null) return mNativePage.getBackgroundColor(); |
- if (mContentViewCore != null) return mContentViewCore.getBackgroundColor(); |
+ if (getWebContents() != null) return getWebContents().getBackgroundColor(); |
return Color.WHITE; |
} |
@@ -622,8 +629,9 @@ public class Tab implements NavigationClient { |
* @param reloadOnChange Reload the page if the user agent has changed. |
*/ |
public void setUseDesktopUserAgent(boolean useDesktop, boolean reloadOnChange) { |
- if (mContentViewCore != null) { |
- mContentViewCore.setUseDesktopUserAgent(useDesktop, reloadOnChange); |
+ if (getWebContents() != null) { |
+ getWebContents().getNavigationController() |
+ .setUseDesktopUserAgent(useDesktop, reloadOnChange); |
} |
} |
@@ -631,7 +639,8 @@ public class Tab implements NavigationClient { |
* @return Whether or not the {@link ContentViewCore} is using a desktop user agent. |
*/ |
public boolean getUseDesktopUserAgent() { |
- return mContentViewCore != null && mContentViewCore.getUseDesktopUserAgent(); |
+ return getWebContents() != null && getWebContents().getNavigationController() |
+ .getUseDesktopUserAgent(); |
} |
/** |
@@ -880,7 +889,7 @@ public class Tab implements NavigationClient { |
*/ |
@CalledByNative |
public String getUrl() { |
- return mContentViewCore != null ? mContentViewCore.getUrl() : ""; |
+ return getWebContents() != null ? getWebContents().getUrl() : ""; |
} |
/** |
@@ -889,7 +898,7 @@ public class Tab implements NavigationClient { |
@CalledByNative |
public String getTitle() { |
if (mNativePage != null) return mNativePage.getTitle(); |
- if (mContentViewCore != null) return mContentViewCore.getTitle(); |
+ if (getWebContents() != null) return getWebContents().getTitle(); |
return ""; |
} |