Chromium Code Reviews| 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..0656280423256f55f8d0093a0ccdf7e8dc3c0913 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,23 @@ public class Tab implements NavigationClient { |
| @Override |
| public void goToNavigationIndex(int index) { |
| - if (mContentViewCore != null) mContentViewCore.goToNavigationIndex(index); |
| + if (getWebContents() != null) getWebContents().getNavigationController(). |
|
Ted C
2014/09/12 00:40:36
The statement and condition all need to fit on a s
AKVT
2014/09/12 14:37:11
Done. Thanks
|
| + 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 +458,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 +536,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 +544,13 @@ 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 +558,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 +626,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 +636,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 +886,7 @@ public class Tab implements NavigationClient { |
| */ |
| @CalledByNative |
| public String getUrl() { |
| - return mContentViewCore != null ? mContentViewCore.getUrl() : ""; |
| + return getWebContents() != null ? getWebContents().getUrl() : ""; |
| } |
| /** |
| @@ -889,7 +895,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 ""; |
| } |