Index: trunk/src/chrome/browser/ui/auto_login_infobar_delegate.cc |
=================================================================== |
--- trunk/src/chrome/browser/ui/auto_login_infobar_delegate.cc (revision 238401) |
+++ trunk/src/chrome/browser/ui/auto_login_infobar_delegate.cc (working copy) |
@@ -13,7 +13,6 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/google/google_util.h" |
-#include "chrome/browser/infobars/infobar.h" |
#include "chrome/browser/infobars/infobar_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/signin/ubertoken_fetcher.h" |
@@ -128,18 +127,19 @@ |
// static |
void AutoLoginInfoBarDelegate::Create(InfoBarService* infobar_service, |
const Params& params) { |
- infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
- scoped_ptr<ConfirmInfoBarDelegate>( |
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
#if defined(OS_ANDROID) |
- new AutoLoginInfoBarDelegateAndroid(params) |
+ new AutoLoginInfoBarDelegateAndroid(infobar_service, params) |
#else |
- new AutoLoginInfoBarDelegate(params) |
+ new AutoLoginInfoBarDelegate(infobar_service, params) |
#endif |
- ))); |
+ )); |
} |
-AutoLoginInfoBarDelegate::AutoLoginInfoBarDelegate(const Params& params) |
- : ConfirmInfoBarDelegate(), |
+AutoLoginInfoBarDelegate::AutoLoginInfoBarDelegate( |
+ InfoBarService* owner, |
+ const Params& params) |
+ : ConfirmInfoBarDelegate(owner), |
params_(params), |
button_pressed_(false) { |
RecordHistogramAction(SHOWN); |
@@ -204,7 +204,10 @@ |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
DCHECK_EQ(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, type); |
- infobar()->RemoveSelf(); |
+ // owner() can be NULL when InfoBarService removes us. See |
+ // |InfoBarDelegate::clear_owner|. |
+ if (owner()) |
+ owner()->RemoveInfoBar(this); |
} |
void AutoLoginInfoBarDelegate::RecordHistogramAction(Actions action) { |