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

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

Issue 2804953003: Refactor ContentViewClient (6/6) (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bf50442977a25bfe0a0a838030e3ed1bf3411279..71554508fe2d7eadf1857b69e94487d6958dbdbe 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
@@ -90,7 +90,6 @@ import org.chromium.components.navigation_interception.InterceptNavigationDelega
import org.chromium.components.security_state.ConnectionSecurityLevel;
import org.chromium.content.browser.ChildProcessLauncher;
import org.chromium.content.browser.ContentView;
-import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.crypto.CipherFactory;
import org.chromium.content_public.browser.GestureStateListener;
@@ -192,7 +191,6 @@ public class Tab
private final ObserverList<TabObserver> mObservers = new ObserverList<>();
// Content layer Observers and Delegates
- private ContentViewClient mContentViewClient;
private TabWebContentsObserver mWebContentsObserver;
private TabWebContentsDelegateAndroid mWebContentsDelegate;
@@ -372,17 +370,6 @@ public class Tab
/** Whether or not the tab closing the tab can send the user back to the app that opened it. */
private boolean mIsAllowedToReturnToExternalApp;
- private class TabContentViewClient extends ContentViewClient {
- @Override
- public int getSystemWindowInsetBottom() {
- ChromeActivity activity = getActivity();
- if (activity != null && activity.getInsetObserverView() != null) {
- return activity.getInsetObserverView().getSystemWindowInsetsBottom();
- }
- return 0;
- }
- }
-
private GestureStateListener createGestureStateListener() {
return new GestureStateListener() {
@Override
@@ -509,8 +496,6 @@ public class Tab
restoreFieldsFromState(frozenState);
}
- setContentViewClient(new TabContentViewClient());
-
mTabRedirectHandler = new TabRedirectHandler(mThemedApplicationContext);
addObserver(mTabObserver);
@@ -1085,26 +1070,6 @@ public class Tab
}
/**
- * @param client The {@link ContentViewClient} to be bound to any current or new
- * {@link ContentViewCore}s associated with this {@link Tab}.
- */
- private void setContentViewClient(ContentViewClient client) {
- if (mContentViewClient == client) return;
-
- ContentViewClient oldClient = mContentViewClient;
- mContentViewClient = client;
-
- if (mContentViewCore == null) return;
-
- if (mContentViewClient != null) {
- mContentViewCore.setContentViewClient(mContentViewClient);
- } else if (oldClient != null) {
- // We can't set a null client, but we should clear references to the last one.
- mContentViewCore.setContentViewClient(new ContentViewClient());
- }
- }
-
- /**
* Called on the foreground tab when the Activity showing the Tab gets started. This is called
* on both cold and warm starts.
*/
@@ -1623,10 +1588,6 @@ public class Tab
mWebContentsObserver =
new TabWebContentsObserver(mContentViewCore.getWebContents(), this);
- if (mContentViewClient != null) {
- mContentViewCore.setContentViewClient(mContentViewClient);
- }
-
mDownloadDelegate = new ChromeDownloadDelegate(mThemedApplicationContext, this);
assert mNativeTabAndroid != 0;
@@ -2819,6 +2780,15 @@ public class Tab
return nativeHasPrerenderedUrl(mNativeTabAndroid, url);
}
+ @VisibleForTesting
+ public int getSystemWindowInsetBottom() {
+ ChromeActivity activity = getActivity();
+ if (activity != null && activity.getInsetObserverView() != null) {
+ return activity.getInsetObserverView().getSystemWindowInsetsBottom();
+ }
+ return 0;
+ }
+
/**
* @return the UMA object for the tab. Note that this may be null in some
* cases.
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/tab/TabViewAndroidDelegate.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698