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

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

Issue 481803004: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments and rebased the patch. Created 6 years, 3 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.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 "";
}

Powered by Google App Engine
This is Rietveld 408576698