Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java |
index c0098ba4a19611688211979aee3000352e7e3fa7..03241fda758fd540437458d134bbee9705c41261 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java |
@@ -9,7 +9,6 @@ import android.graphics.Bitmap; |
import android.view.View; |
import android.widget.TextView; |
-import org.chromium.base.VisibleForTesting; |
import org.chromium.base.annotations.CalledByNative; |
import org.chromium.chrome.R; |
@@ -25,31 +24,24 @@ public abstract class InfoBar implements InfoBarView { |
private final Bitmap mIconBitmap; |
private final CharSequence mMessage; |
- private InfoBarListeners.Dismiss mListener; |
private InfoBarContainer mContainer; |
private View mView; |
private Context mContext; |
- private boolean mExpireOnNavigation; |
private boolean mIsDismissed; |
private boolean mControlsEnabled = true; |
- private boolean mIsJavaOnlyInfoBar = true; |
// This points to the InfoBarAndroid class not any of its subclasses. |
private long mNativeInfoBarPtr; |
/** |
- * @param listener Listens to when buttons have been clicked on the InfoBar. |
* @param iconDrawableId ID of the resource to use for the Icon. If 0, no icon will be shown. |
* @param message The message to show in the infobar. |
*/ |
- public InfoBar(InfoBarListeners.Dismiss listener, int iconDrawableId, Bitmap iconBitmap, |
- CharSequence message) { |
- mListener = listener; |
+ public InfoBar(int iconDrawableId, Bitmap iconBitmap, CharSequence message) { |
mIconDrawableId = iconDrawableId; |
mIconBitmap = iconBitmap; |
mMessage = message; |
- mExpireOnNavigation = true; |
} |
/** |
@@ -58,12 +50,8 @@ public abstract class InfoBar implements InfoBarView { |
*/ |
@CalledByNative |
private void setNativeInfoBar(long nativeInfoBarPtr) { |
- if (nativeInfoBarPtr != 0) { |
- // The native code takes care of expiring infobars on navigations. |
- mExpireOnNavigation = false; |
- mNativeInfoBarPtr = nativeInfoBarPtr; |
- mIsJavaOnlyInfoBar = false; |
- } |
+ assert mNativeInfoBarPtr == 0; |
+ mNativeInfoBarPtr = nativeInfoBarPtr; |
} |
@CalledByNative |
@@ -72,22 +60,6 @@ public abstract class InfoBar implements InfoBarView { |
} |
/** |
- * Determine if the infobar should be dismissed when a new page starts loading. Calling |
- * setExpireOnNavigation(true/false) causes this method always to return true/false. |
- * This only applies to java-only infobars. C++ infobars will use the same logic |
- * as other platforms so they are not attempted to be dismissed twice. |
- * It should really be removed once all infobars have a C++ counterpart. |
- */ |
- public final boolean shouldExpire() { |
- return mExpireOnNavigation && mIsJavaOnlyInfoBar; |
- } |
- |
- // Sets whether the bar should be dismissed when a navigation occurs. |
- public void setExpireOnNavigation(boolean expireOnNavigation) { |
- mExpireOnNavigation = expireOnNavigation; |
- } |
- |
- /** |
* Sets the Context used when creating the InfoBar. |
*/ |
protected void setContext(Context context) { |
@@ -143,20 +115,10 @@ public abstract class InfoBar implements InfoBarView { |
} |
/** |
- * Used to close a java only infobar. |
- */ |
- public void dismissJavaOnlyInfoBar() { |
- assert mNativeInfoBarPtr == 0; |
- if (closeInfoBar() && mListener != null) { |
- mListener.onInfoBarDismissed(this); |
- } |
- } |
- |
- /** |
* @return whether the infobar actually needed closing. |
*/ |
@CalledByNative |
- public boolean closeInfoBar() { |
+ private boolean closeInfoBar() { |
if (!mIsDismissed) { |
mIsDismissed = true; |
if (!mContainer.hasBeenDestroyed()) { |
@@ -201,22 +163,13 @@ public abstract class InfoBar implements InfoBarView { |
@Override |
public void onCloseButtonClicked() { |
- if (mIsJavaOnlyInfoBar) { |
- dismissJavaOnlyInfoBar(); |
- } else { |
- if (mNativeInfoBarPtr != 0) nativeOnCloseButtonClicked(mNativeInfoBarPtr); |
- } |
+ if (mNativeInfoBarPtr != 0) nativeOnCloseButtonClicked(mNativeInfoBarPtr); |
} |
@Override |
public void createContent(InfoBarLayout layout) { |
} |
- @VisibleForTesting |
- public void setDismissedListener(InfoBarListeners.Dismiss listener) { |
- mListener = listener; |
- } |
- |
private native void nativeOnLinkClicked(long nativeInfoBarAndroid); |
private native void nativeOnButtonClicked(long nativeInfoBarAndroid, int action); |
private native void nativeOnCloseButtonClicked(long nativeInfoBarAndroid); |