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

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

Issue 2124243002: Refactor the Java AppBannerManager to be owned by native code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 b168c932c13076965547540bdaf3e825c40061ae..1c73129262b33c3ed86c7a4b120c6896d69eaba6 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
@@ -180,9 +180,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
/** InfoBar container to show InfoBars for this tab. */
private InfoBarContainer mInfoBarContainer;
- /** Manages app banners shown for this tab. */
- private AppBannerManager mAppBannerManager;
-
/** Controls overscroll pull-to-refresh behavior for this tab. */
private SwipeRefreshHandler mSwipeRefreshHandler;
@@ -1435,11 +1432,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
RevenueStats.getInstance().tabCreated(this);
- if (AppBannerManager.isEnabled()) {
- mAppBannerManager = mDelegateFactory.createAppBannerManager(this);
- if (mAppBannerManager != null) addObserver(mAppBannerManager);
- }
-
mTopControlsVisibilityDelegate =
mDelegateFactory.createTopControlsVisibilityDelegate(this);
@@ -1472,6 +1464,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
didStartPageLoad(webContents.getUrl(), false);
}
} finally {
+ AppBannerManager.setIsEnabled(mDelegateFactory.allowAppBanners(this));
gone 2016/07/07 20:41:14 Eh, why is this here? The only reason the ugly tr
dominickn 2016/07/08 01:17:53 Thanks for clarifying. I've split up the enabled c
+
if (mTimestampMillis == INVALID_TIMESTAMP) {
mTimestampMillis = System.currentTimeMillis();
}
@@ -1561,7 +1555,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
mWebContentsDelegate, mDelegateFactory.createContextMenuPopulator(this));
mTopControlsVisibilityDelegate = mDelegateFactory.createTopControlsVisibilityDelegate(this);
setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigationDelegate(this));
- mAppBannerManager = mDelegateFactory.createAppBannerManager(this);
+ AppBannerManager.setIsEnabled(mDelegateFactory.allowAppBanners(this));
// Reload the NativePage (if any), since the old NativePage has a reference to the old
// activity.
@@ -2031,13 +2025,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
mInfoBarContainer = null;
}
- // Destroy the AppBannerManager after the InfoBarContainer because it monitors for infobar
- // removals.
- if (mAppBannerManager != null) {
- mAppBannerManager.destroy();
- mAppBannerManager = null;
- }
-
mPreviousFullscreenTopControlsOffsetY = Float.NaN;
mPreviousFullscreenContentOffsetY = Float.NaN;
@@ -2528,13 +2515,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
}
}
- /** Requests the app banner. This method is called from the DevTools. */
- protected boolean requestAppBanner() {
- if (mAppBannerManager == null) return false;
- mAppBannerManager.requestAppBanner();
- return true;
- }
-
@CalledByNative
private void clearNativePtr() {
assert mNativeTabAndroid != 0;
@@ -3005,7 +2985,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
*/
@VisibleForTesting
public AppBannerManager getAppBannerManagerForTesting() {
- return mAppBannerManager;
+ return AppBannerManager.getAppBannerManager(getWebContents());
}
@VisibleForTesting

Powered by Google App Engine
This is Rietveld 408576698