summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 15:07:08 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-30 15:07:08 +0000
commit95a33ed6cb8688573249f7cd7032d23518879c6d (patch)
tree77c2f8d28412caa3aeb6cdb94de420bb811113d6 /chrome/browser/tab_contents/tab_contents_ssl_helper.cc
parent14ea9bf12826e740fd77fda742e67605df06ce4a (diff)
downloadchromium_src-95a33ed6cb8688573249f7cd7032d23518879c6d.zip
chromium_src-95a33ed6cb8688573249f7cd7032d23518879c6d.tar.gz
chromium_src-95a33ed6cb8688573249f7cd7032d23518879c6d.tar.bz2
Move infobar handling to a tab helper.
Part 2: - Removed TabContentsWrapper from core infobar classes - Made InfoBarTabHelper the owner of the infobar delegates - Removed all owner references from the delegate subclasses BUG=94741 TEST=no visible change Review URL: http://codereview.chromium.org/7862003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103463 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/tab_contents_ssl_helper.cc')
-rw-r--r--chrome/browser/tab_contents/tab_contents_ssl_helper.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
index 317e4b5..b8cae38 100644
--- a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
+++ b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
@@ -14,12 +14,12 @@
#include "base/values.h"
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/ssl_add_cert_handler.h"
#include "chrome/browser/ssl_client_certificate_selector.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
-#include "chrome/browser/tab_contents/infobar.h"
#include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
@@ -63,7 +63,7 @@ bool CertMatchesFilter(const net::X509Certificate& cert,
class SSLCertAddedInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
- SSLCertAddedInfoBarDelegate(TabContents* tab_contents,
+ SSLCertAddedInfoBarDelegate(InfoBarTabHelper* infobar_helper,
net::X509Certificate* cert);
private:
@@ -77,15 +77,13 @@ class SSLCertAddedInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
virtual bool Accept() OVERRIDE;
- TabContents* tab_contents_; // The TabContents we are attached to.
scoped_refptr<net::X509Certificate> cert_; // The cert we added.
};
SSLCertAddedInfoBarDelegate::SSLCertAddedInfoBarDelegate(
- TabContents* tab_contents,
+ InfoBarTabHelper* infobar_helper,
net::X509Certificate* cert)
- : ConfirmInfoBarDelegate(tab_contents),
- tab_contents_(tab_contents),
+ : ConfirmInfoBarDelegate(infobar_helper),
cert_(cert) {
}
@@ -117,7 +115,7 @@ string16 SSLCertAddedInfoBarDelegate::GetButtonLabel(
}
bool SSLCertAddedInfoBarDelegate::Accept() {
- ShowCertificateViewer(tab_contents_->GetDialogRootWindow(), cert_);
+ ShowCertificateViewer(owner()->tab_contents()->GetDialogRootWindow(), cert_);
return false; // Hiding the infobar just as the dialog opens looks weird.
}
@@ -156,7 +154,7 @@ TabContentsSSLHelper::SSLAddCertData::SSLAddCertData(
TabContentsWrapper* tab_contents)
: tab_contents_(tab_contents),
infobar_delegate_(NULL) {
- Source<TabContentsWrapper> source(tab_contents_);
+ Source<InfoBarTabHelper> source(tab_contents_->infobar_tab_helper());
registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED,
source);
registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED,
@@ -179,7 +177,7 @@ void TabContentsSSLHelper::SSLAddCertData::ShowInfoBar(
void TabContentsSSLHelper::SSLAddCertData::ShowErrorInfoBar(
const string16& message) {
ShowInfoBar(new SimpleAlertInfoBarDelegate(
- tab_contents_->tab_contents(), GetCertIcon(), message, true));
+ tab_contents_->infobar_tab_helper(), GetCertIcon(), message, true));
}
void TabContentsSSLHelper::SSLAddCertData::Observe(
@@ -274,7 +272,7 @@ void TabContentsSSLHelper::OnAddClientCertificateSuccess(
SSLAddCertData* add_cert_data = GetAddCertData(handler);
// Display an infobar to inform the user.
add_cert_data->ShowInfoBar(new SSLCertAddedInfoBarDelegate(
- tab_contents_->tab_contents(), handler->cert()));
+ tab_contents_->infobar_tab_helper(), handler->cert()));
}
void TabContentsSSLHelper::OnAddClientCertificateError(