summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents_ssl_helper.cc27
-rw-r--r--chrome/browser/tab_contents/tab_contents_ssl_helper.h39
2 files changed, 41 insertions, 25 deletions
diff --git a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
index a0bd215..8bc32d5 100644
--- a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
+++ b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc
@@ -100,7 +100,7 @@ bool SSLCertAddedInfoBarDelegate::Accept() {
class TabContentsSSLHelper::SSLAddCertData : public NotificationObserver {
public:
- explicit SSLAddCertData(TabContents* tab_contents);
+ explicit SSLAddCertData(TabContentsWrapper* tab_contents);
virtual ~SSLAddCertData();
// Displays |delegate| as an infobar in |tab_|, replacing our current one if
@@ -117,17 +117,18 @@ class TabContentsSSLHelper::SSLAddCertData : public NotificationObserver {
const NotificationSource& source,
const NotificationDetails& details);
- TabContents* tab_contents_;
+ TabContentsWrapper* tab_contents_;
InfoBarDelegate* infobar_delegate_;
NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(SSLAddCertData);
};
-TabContentsSSLHelper::SSLAddCertData::SSLAddCertData(TabContents* tab_contents)
+TabContentsSSLHelper::SSLAddCertData::SSLAddCertData(
+ TabContentsWrapper* tab_contents)
: tab_contents_(tab_contents),
infobar_delegate_(NULL) {
- Source<TabContents> source(tab_contents_);
+ Source<TabContents> source(tab_contents_->tab_contents());
registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source);
registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, source);
}
@@ -137,19 +138,17 @@ TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() {
void TabContentsSSLHelper::SSLAddCertData::ShowInfoBar(
InfoBarDelegate* delegate) {
- TabContentsWrapper* wrapper =
- TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_);
if (infobar_delegate_)
- wrapper->ReplaceInfoBar(infobar_delegate_, delegate);
+ tab_contents_->ReplaceInfoBar(infobar_delegate_, delegate);
else
- wrapper->AddInfoBar(delegate);
+ tab_contents_->AddInfoBar(delegate);
infobar_delegate_ = delegate;
}
void TabContentsSSLHelper::SSLAddCertData::ShowErrorInfoBar(
const string16& message) {
- ShowInfoBar(new SimpleAlertInfoBarDelegate(tab_contents_, GetCertIcon(),
- message, true));
+ ShowInfoBar(new SimpleAlertInfoBarDelegate(
+ tab_contents_->tab_contents(), GetCertIcon(), message, true));
}
void TabContentsSSLHelper::SSLAddCertData::Observe(
@@ -167,7 +166,7 @@ void TabContentsSSLHelper::SSLAddCertData::Observe(
// TabContentsSSLHelper -------------------------------------------------------
-TabContentsSSLHelper::TabContentsSSLHelper(TabContents* tab_contents)
+TabContentsSSLHelper::TabContentsSSLHelper(TabContentsWrapper* tab_contents)
: tab_contents_(tab_contents) {
}
@@ -177,7 +176,7 @@ TabContentsSSLHelper::~TabContentsSSLHelper() {
void TabContentsSSLHelper::ShowClientCertificateRequestDialog(
scoped_refptr<SSLClientAuthHandler> handler) {
browser::ShowSSLClientCertificateSelector(
- tab_contents_, handler->cert_request_info(), handler);
+ tab_contents_->tab_contents(), handler->cert_request_info(), handler);
}
void TabContentsSSLHelper::OnVerifyClientCertificateError(
@@ -200,8 +199,8 @@ void TabContentsSSLHelper::OnAddClientCertificateSuccess(
scoped_refptr<SSLAddCertHandler> handler) {
SSLAddCertData* add_cert_data = GetAddCertData(handler);
// Display an infobar to inform the user.
- add_cert_data->ShowInfoBar(
- new SSLCertAddedInfoBarDelegate(tab_contents_, handler->cert()));
+ add_cert_data->ShowInfoBar(new SSLCertAddedInfoBarDelegate(
+ tab_contents_->tab_contents(), handler->cert()));
}
void TabContentsSSLHelper::OnAddClientCertificateError(
diff --git a/chrome/browser/tab_contents/tab_contents_ssl_helper.h b/chrome/browser/tab_contents/tab_contents_ssl_helper.h
index 9fc5490..8ee4076 100644
--- a/chrome/browser/tab_contents/tab_contents_ssl_helper.h
+++ b/chrome/browser/tab_contents/tab_contents_ssl_helper.h
@@ -13,29 +13,46 @@
class SSLAddCertHandler;
class SSLClientAuthHandler;
-class TabContents;
+class TabContentsWrapper;
-class TabContentsSSLHelper : public RenderViewHostDelegate::SSL {
+class TabContentsSSLHelper {
public:
- explicit TabContentsSSLHelper(TabContents* tab_contents);
+ explicit TabContentsSSLHelper(TabContentsWrapper* tab_contents);
virtual ~TabContentsSSLHelper();
- // RenderViewHostDelegate::SSL implementation:
- virtual void ShowClientCertificateRequestDialog(
+ // Displays a dialog to select client certificates from |request_info|,
+ // returning them to |handler|.
+ void ShowClientCertificateRequestDialog(
scoped_refptr<SSLClientAuthHandler> handler);
- virtual void OnVerifyClientCertificateError(
+
+ // Called when |handler| encounters an error in verifying a received client
+ // certificate. Note that, because CAs often will not send us intermediate
+ // certificates, the verification we can do is minimal: we verify the
+ // certificate is parseable, that we have the corresponding private key, and
+ // that the certificate has not expired.
+ void OnVerifyClientCertificateError(
scoped_refptr<SSLAddCertHandler> handler, int error_code);
- virtual void AskToAddClientCertificate(
+
+ // Called when |handler| requests the user's confirmation in adding a client
+ // certificate.
+ void AskToAddClientCertificate(
scoped_refptr<SSLAddCertHandler> handler);
- virtual void OnAddClientCertificateSuccess(
+
+ // Called when |handler| successfully adds a client certificate.
+ void OnAddClientCertificateSuccess(
scoped_refptr<SSLAddCertHandler> handler);
- virtual void OnAddClientCertificateError(
+
+ // Called when |handler| encounters an error adding a client certificate.
+ void OnAddClientCertificateError(
scoped_refptr<SSLAddCertHandler> handler, int error_code);
- virtual void OnAddClientCertificateFinished(
+
+ // Called when |handler| has completed, so the delegate may release any state
+ // accumulated.
+ void OnAddClientCertificateFinished(
scoped_refptr<SSLAddCertHandler> handler);
private:
- TabContents* tab_contents_;
+ TabContentsWrapper* tab_contents_;
class SSLAddCertData;
std::map<int, linked_ptr<SSLAddCertData> > request_id_to_add_cert_data_;