Index: trunk/src/chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc |
=================================================================== |
--- trunk/src/chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc (revision 238401) |
+++ trunk/src/chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc (working copy) |
@@ -8,7 +8,6 @@ |
#include "base/android/jni_helper.h" |
#include "base/android/jni_string.h" |
#include "base/strings/utf_string_conversions.h" |
-#include "chrome/browser/infobars/infobar.h" |
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
#include "chrome/browser/ui/auto_login_infobar_delegate.h" |
#include "content/public/browser/web_contents.h" |
@@ -22,8 +21,9 @@ |
AutoLoginInfoBarDelegateAndroid::AutoLoginInfoBarDelegateAndroid( |
+ InfoBarService* owner, |
const Params& params) |
- : AutoLoginInfoBarDelegate(params), |
+ : AutoLoginInfoBarDelegate(owner, params), |
params_(params) { |
} |
@@ -82,36 +82,37 @@ |
void AutoLoginInfoBarDelegateAndroid::LoginSuccess(JNIEnv* env, |
jobject obj, |
jstring result) { |
- if (!infobar()->owner()) |
+ if (!owner()) |
return; // We're closing; don't call anything, it might access the owner. |
// TODO(miguelg): Test whether the Stop() and RemoveInfoBar() calls here are |
// necessary, or whether OpenURL() will do this for us. |
- content::WebContents* contents = web_contents(); |
- contents->Stop(); |
- infobar()->RemoveSelf(); |
+ content::WebContents* web_contents = owner()->web_contents(); |
+ web_contents->Stop(); |
+ owner()->RemoveInfoBar(this); |
// WARNING: |this| may be deleted at this point! Do not access any members! |
- contents->OpenURL(content::OpenURLParams( |
+ web_contents->OpenURL(content::OpenURLParams( |
GURL(base::android::ConvertJavaStringToUTF8(env, result)), |
content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, |
false)); |
} |
void AutoLoginInfoBarDelegateAndroid::LoginFailed(JNIEnv* env, jobject obj) { |
- if (!infobar()->owner()) |
+ if (!owner()) |
return; // We're closing; don't call anything, it might access the owner. |
// TODO(miguelg): Using SimpleAlertInfoBarDelegate::Create() animates in a new |
// infobar while we animate the current one closed. It would be better to use |
// ReplaceInfoBar(). |
SimpleAlertInfoBarDelegate::Create( |
- infobar()->owner(), IDR_INFOBAR_WARNING, |
+ owner(), IDR_INFOBAR_WARNING, |
l10n_util::GetStringUTF16(IDS_AUTO_LOGIN_FAILED), false); |
- infobar()->RemoveSelf(); |
+ owner()->RemoveInfoBar(this); |
} |
void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) { |
- infobar()->RemoveSelf(); |
+ if (owner()) |
+ owner()->RemoveInfoBar(this); |
} |
bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) { |