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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBar.java

Issue 26263002: [InfoBar] Always close native infobars from C++. Part II (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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/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 77e5c0393e98aba8222b27d04dd3ba99dc98feb3..600b867c62215e59ef78c406900af7e6e3a3afdf 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
@@ -53,6 +53,8 @@ public abstract class InfoBar implements InfoBarView {
private boolean mIsDismissed;
private boolean mControlsEnabled;
+ // TODO(miguelg) make it private and enforce it in the Confirm and Translate
+ // infobars.
protected int mNativeInfoBarPtr;
// Used by tests to reference infobars.
@@ -149,20 +151,16 @@ public abstract class InfoBar implements InfoBarView {
}
/**
- * Used to close an infobar from java. In addition to closing the infobar, notifies native
- * that the bar needs closing.
+ * Used to close a java only infobar.
*/
- public void dismiss() {
- if (closeInfoBar() && mNativeInfoBarPtr != 0) {
- // We are being closed from Java, notify C++.
- nativeOnInfoBarClosed(mNativeInfoBarPtr);
- mNativeInfoBarPtr = 0;
+ public void dismissJavaOnlyInfoBar() {
+ assert mNativeInfoBarPtr == 0;
+ if (closeInfoBar() && mListener != null) {
+ mListener.onInfoBarDismissed(this);
}
}
/**
- * Used to close an infobar from native.
- *
* @return whether the infobar actually needed closing.
*/
@CalledByNative
@@ -173,9 +171,6 @@ public abstract class InfoBar implements InfoBarView {
// If the container was destroyed, it's already been emptied of all its infobars.
mContainer.removeInfoBar(this);
}
- if (mListener != null) {
- mListener.onInfoBarDismissed(this);
- }
return true;
}
return false;
@@ -230,11 +225,6 @@ public abstract class InfoBar implements InfoBarView {
}
@Override
- public void onCloseButtonClicked() {
- dismiss();
- }
-
- @Override
public void createContent(InfoBarLayout layout) {
}
@@ -266,7 +256,6 @@ public abstract class InfoBar implements InfoBarView {
}
protected native void nativeOnLinkClicked(int nativeInfoBarAndroid);
- protected native void nativeOnInfoBarClosed(int nativeInfoBarAndroid);
protected native void nativeOnButtonClicked(
int nativeInfoBarAndroid, int action, String actionValue);
protected native void nativeOnCloseButtonClicked(int nativeInfoBarAndroid);

Powered by Google App Engine
This is Rietveld 408576698