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

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

Issue 2235533002: Revert "Changed NavigationController access to through tab in Java code" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 4b71331ee3779e9f099b5a800d243527a23809da..9a19635f6b5200dd89e1445b187604bcef6eba5f 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
@@ -66,8 +66,6 @@ import org.chromium.chrome.browser.fullscreen.FullscreenManager;
import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.infobar.InfoBarContainer;
import org.chromium.chrome.browser.media.ui.MediaSessionTabHelper;
-import org.chromium.chrome.browser.navigation.NavigationHandler;
-import org.chromium.chrome.browser.navigation.TabWebContentsNavigationHandler;
import org.chromium.chrome.browser.ntp.NativePageAssassin;
import org.chromium.chrome.browser.ntp.NativePageFactory;
import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader;
@@ -388,16 +386,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
/** Whether or not the tab closing the tab can send the user back to the app that opened it. */
private boolean mIsAllowedToReturnToExternalApp;
- private NavigationHandler mNavigationHandler;
-
- /**
- * Method to access navigation handler for a tab.
- * @return navigation handler.
- */
- public NavigationHandler getNavigationHandler() {
- return mNavigationHandler;
- }
-
private class TabContentViewClient extends ContentViewClient {
@Override
public void onBackgroundColorChanged(int color) {
@@ -746,43 +734,44 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* @return Whether or not this tab has a previous navigation entry.
*/
public boolean canGoBack() {
- return getNavigationHandler() != null && getNavigationHandler().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 getNavigationHandler() != null && getNavigationHandler().canGoForward();
+ return getWebContents() != null && getWebContents().getNavigationController()
+ .canGoForward();
}
/**
* Goes to the navigation entry before the current one.
*/
public void goBack() {
- if (getNavigationHandler() != null) getNavigationHandler().goBack();
+ if (getWebContents() != null) getWebContents().getNavigationController().goBack();
}
/**
* Goes to the navigation entry after the current one.
*/
public void goForward() {
- if (getNavigationHandler() != null) getNavigationHandler().goForward();
+ if (getWebContents() != null) getWebContents().getNavigationController().goForward();
}
/**
* Loads the current navigation if there is a pending lazy load (after tab restore).
*/
public void loadIfNecessary() {
- if (getNavigationHandler() != null) getNavigationHandler().loadIfNecessary();
+ if (getWebContents() != null) getWebContents().getNavigationController().loadIfNecessary();
}
/**
* Requests the current navigation to be loaded upon the next call to loadIfNecessary().
*/
protected void requestRestoreLoad() {
- if (getNavigationHandler() != null) {
- getNavigationHandler().requestRestoreLoad();
+ if (getWebContents() != null) {
+ getWebContents().getNavigationController().requestRestoreLoad();
}
}
@@ -1002,7 +991,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
*/
public void reload() {
// TODO(dtrainor): Should we try to rebuild the ContentView if it's frozen?
- if (getNavigationHandler() != null) getNavigationHandler().reload(true);
+ if (getWebContents() != null) getWebContents().getNavigationController().reload(true);
}
/**
@@ -1010,8 +999,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* This version ignores the cache and reloads from the network.
*/
public void reloadIgnoringCache() {
- if (getNavigationHandler() != null) {
- getNavigationHandler().reloadBypassingCache(true);
+ if (getWebContents() != null) {
+ getWebContents().getNavigationController().reloadBypassingCache(true);
}
}
@@ -1020,8 +1009,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* This version ignores the cache and reloads from the network.
*/
public void reloadDisableLoFi() {
- if (getNavigationHandler() != null) {
- getNavigationHandler().reloadDisableLoFi(true);
+ if (getWebContents() != null) {
+ getWebContents().getNavigationController().reloadDisableLoFi(true);
}
}
@@ -1198,8 +1187,9 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* @param reloadOnChange Reload the page if the user agent has changed.
*/
public void setUseDesktopUserAgent(boolean useDesktop, boolean reloadOnChange) {
- if (getNavigationHandler() != null) {
- getNavigationHandler().setUseDesktopUserAgent(useDesktop, reloadOnChange);
+ if (getWebContents() != null) {
+ getWebContents().getNavigationController()
+ .setUseDesktopUserAgent(useDesktop, reloadOnChange);
}
}
@@ -1207,8 +1197,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* @return Whether or not the {@link ContentViewCore} is using a desktop user agent.
*/
public boolean getUseDesktopUserAgent() {
- return getNavigationHandler() != null
- && getNavigationHandler().getUseDesktopUserAgent();
+ return getWebContents() != null && getWebContents().getNavigationController()
+ .getUseDesktopUserAgent();
}
/**
@@ -1862,9 +1852,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
new TabContextMenuPopulator(
mDelegateFactory.createContextMenuPopulator(this), this));
- // TODO(shaktisahu): Add logic for blimp version of navigation handler.
- mNavigationHandler = new TabWebContentsNavigationHandler(getWebContents());
-
// In the case where restoring a Tab or showing a prerendered one we already have a
// valid infobar container, no need to recreate one.
if (mInfoBarContainer == null) {
@@ -1878,7 +1865,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
mInfoBarContainer.setContentViewCore(mContentViewCore);
mSwipeRefreshHandler = new SwipeRefreshHandler(mThemedApplicationContext);
- mSwipeRefreshHandler.setContentViewCore(mContentViewCore, getNavigationHandler());
+ mSwipeRefreshHandler.setContentViewCore(mContentViewCore);
updateThemeColorIfNeeded(false);
notifyContentChanged();
@@ -2379,12 +2366,9 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
mInfoBarContainer.setContentViewCore(null);
}
if (mSwipeRefreshHandler != null) {
- mSwipeRefreshHandler.setContentViewCore(null, null);
+ mSwipeRefreshHandler.setContentViewCore(null);
mSwipeRefreshHandler = null;
}
-
- mNavigationHandler = null;
-
mContentViewParent = null;
mContentViewCore.destroy();
mContentViewCore = null;

Powered by Google App Engine
This is Rietveld 408576698