Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java |
| index 236c9c93d87c9edf251beec7f9fdfcc02a108f81..3e8afafbdb45f0a6431e69dcb237f4a7e4e71597 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainer.java |
| @@ -4,6 +4,7 @@ |
| package org.chromium.chrome.browser.infobar; |
| +import android.app.Activity; |
| import android.content.Context; |
| import android.view.Gravity; |
| import android.view.View; |
| @@ -14,7 +15,9 @@ import org.chromium.base.ObserverList; |
| import org.chromium.base.VisibleForTesting; |
| import org.chromium.base.annotations.CalledByNative; |
| import org.chromium.chrome.R; |
| +import org.chromium.chrome.browser.ChromeActivity; |
| import org.chromium.chrome.browser.banners.SwipableOverlayView; |
| +import org.chromium.chrome.browser.snackbar.SnackbarManager; |
| import org.chromium.chrome.browser.tab.EmptyTabObserver; |
| import org.chromium.chrome.browser.tab.Tab; |
| import org.chromium.chrome.browser.tab.TabObserver; |
| @@ -151,11 +154,19 @@ public class InfoBarContainer extends SwipableOverlayView { |
| private final ObserverList<InfoBarContainerObserver> mObservers = |
| new ObserverList<InfoBarContainerObserver>(); |
| + /** The snackbar manager instance used by the activity that hosts this infobar. */ |
| + private SnackbarManager mSnackbarManager; |
| + |
| public InfoBarContainer(Context context, final ViewGroup parentView, Tab tab) { |
| super(context, null); |
| tab.addObserver(mTabObserver); |
| mTabView = tab.getView(); |
| + Activity activity = tab.getActivity(); |
| + if (activity != null && activity instanceof ChromeActivity) { |
| + mSnackbarManager = ((ChromeActivity) activity).getSnackbarManager(); |
| + } |
|
gone
2017/04/26 17:27:02
This won't work if the tab is sent to another Acti
ramyasharma
2017/04/27 08:03:11
Thanks done. How can I test re-parenting from the
gone
2017/04/27 18:48:57
Re-parenting currently moves a tab from a CustomTa
|
| + |
| // TODO(newt): move this workaround into the infobar views if/when they're scrollable. |
| // Workaround for http://crbug.com/407149. See explanation in onMeasure() below. |
| setVerticalScrollBarEnabled(false); |
| @@ -178,6 +189,10 @@ public class InfoBarContainer extends SwipableOverlayView { |
| mNativeInfoBarContainer = nativeInit(); |
| } |
| + public SnackbarManager getSnackbarManager() { |
| + return mSnackbarManager; |
| + } |
| + |
| /** |
| * Adds an {@link InfoBarContainerObserver}. |
| * @param observer The {@link InfoBarContainerObserver} to add. |