| Index: chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc
|
| ===================================================================
|
| --- chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc (revision 238220)
|
| +++ chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc (working copy)
|
| @@ -8,6 +8,7 @@
|
| #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"
|
| @@ -21,9 +22,8 @@
|
|
|
|
|
| AutoLoginInfoBarDelegateAndroid::AutoLoginInfoBarDelegateAndroid(
|
| - InfoBarService* owner,
|
| const Params& params)
|
| - : AutoLoginInfoBarDelegate(owner, params),
|
| + : AutoLoginInfoBarDelegate(params),
|
| params_(params) {
|
| }
|
|
|
| @@ -82,16 +82,16 @@
|
| void AutoLoginInfoBarDelegateAndroid::LoginSuccess(JNIEnv* env,
|
| jobject obj,
|
| jstring result) {
|
| - if (!owner())
|
| + if (!infobar()->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* web_contents = owner()->web_contents();
|
| - web_contents->Stop();
|
| - owner()->RemoveInfoBar(this);
|
| + content::WebContents* contents = web_contents();
|
| + contents->Stop();
|
| + infobar()->RemoveSelf();
|
| // WARNING: |this| may be deleted at this point! Do not access any members!
|
| - web_contents->OpenURL(content::OpenURLParams(
|
| + contents->OpenURL(content::OpenURLParams(
|
| GURL(base::android::ConvertJavaStringToUTF8(env, result)),
|
| content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK,
|
| false));
|
| @@ -98,7 +98,7 @@
|
| }
|
|
|
| void AutoLoginInfoBarDelegateAndroid::LoginFailed(JNIEnv* env, jobject obj) {
|
| - if (!owner())
|
| + if (!infobar()->owner())
|
| return; // We're closing; don't call anything, it might access the owner.
|
|
|
| // TODO(miguelg): Using SimpleAlertInfoBarDelegate::Create() animates in a new
|
| @@ -105,14 +105,13 @@
|
| // infobar while we animate the current one closed. It would be better to use
|
| // ReplaceInfoBar().
|
| SimpleAlertInfoBarDelegate::Create(
|
| - owner(), IDR_INFOBAR_WARNING,
|
| + infobar()->owner(), IDR_INFOBAR_WARNING,
|
| l10n_util::GetStringUTF16(IDS_AUTO_LOGIN_FAILED), false);
|
| - owner()->RemoveInfoBar(this);
|
| + infobar()->RemoveSelf();
|
| }
|
|
|
| void AutoLoginInfoBarDelegateAndroid::LoginDismiss(JNIEnv* env, jobject obj) {
|
| - if (owner())
|
| - owner()->RemoveInfoBar(this);
|
| + infobar()->RemoveSelf();
|
| }
|
|
|
| bool AutoLoginInfoBarDelegateAndroid::Register(JNIEnv* env) {
|
|
|