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

Unified Diff: chrome/browser/ui/android/infobars/auto_login_infobar_delegate_android.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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/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) {

Powered by Google App Engine
This is Rietveld 408576698