Index: chrome/browser/autofill/autofill_cc_infobar_delegate.cc |
=================================================================== |
--- chrome/browser/autofill/autofill_cc_infobar_delegate.cc (revision 54564) |
+++ chrome/browser/autofill/autofill_cc_infobar_delegate.cc (working copy) |
@@ -9,6 +9,7 @@ |
#include "base/histogram.h" |
#include "chrome/browser/autofill/autofill_cc_infobar.h" |
#include "chrome/browser/autofill/autofill_manager.h" |
+#include "chrome/browser/browser.h" |
#include "chrome/browser/pref_service.h" |
#include "chrome/browser/profile.h" |
#include "chrome/browser/tab_contents/tab_contents.h" |
@@ -22,9 +23,15 @@ |
AutoFillCCInfoBarDelegate::AutoFillCCInfoBarDelegate(TabContents* tab_contents, |
AutoFillManager* host) |
: ConfirmInfoBarDelegate(tab_contents), |
+ browser_(NULL), |
host_(host) { |
- if (tab_contents) |
+ if (tab_contents) { |
+ // This is NULL for TestTabContents. |
+ if (tab_contents->delegate()) |
+ browser_ = tab_contents->delegate()->GetBrowser(); |
+ |
tab_contents->AddInfoBar(this); |
+ } |
} |
AutoFillCCInfoBarDelegate::~AutoFillCCInfoBarDelegate() { |
@@ -96,8 +103,8 @@ |
} |
bool AutoFillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
- host_->tab_contents()->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), |
- NEW_FOREGROUND_TAB, PageTransition::TYPED); |
+ browser_->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), NEW_FOREGROUND_TAB, |
+ PageTransition::TYPED); |
return false; |
} |