Index: chrome/browser/ssl/ssl_client_auth_observer.h |
diff --git a/chrome/browser/ssl/ssl_client_auth_observer.h b/chrome/browser/ssl/ssl_client_auth_observer.h |
index 62e3fde9ddfd8c4c161768ef423895508b054379..ee2613481925541d32f659e6273a11d6ce828661 100644 |
--- a/chrome/browser/ssl/ssl_client_auth_observer.h |
+++ b/chrome/browser/ssl/ssl_client_auth_observer.h |
@@ -7,6 +7,7 @@ |
#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -17,24 +18,32 @@ class X509Certificate; |
namespace content { |
class BrowserContext; |
+class ClientCertificateDelegate; |
} |
+// SSLClientAuthObserver is a base class that wraps a |
+// ClientCertificateDelegate. It links client certificate selection dialogs |
+// attached to the same BrowserContext. When CertificateSelected is called via |
+// one of them, the rest simulate the same action. |
class SSLClientAuthObserver : public content::NotificationObserver { |
public: |
SSLClientAuthObserver( |
const content::BrowserContext* browser_context, |
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, |
- const base::Callback<void(net::X509Certificate*)>& callback); |
+ scoped_ptr<content::ClientCertificateDelegate> delegate); |
~SSLClientAuthObserver() override; |
// UI should implement this to close the dialog. |
virtual void OnCertSelectedByNotification() = 0; |
- // Send content the certificate. Can also call with NULL if the user |
- // cancelled. Derived classes must use this instead of caching the callback |
- // and calling it directly. |
+ // Continues the request with a certificate. Can also call with NULL to |
+ // continue with no certificate. Derived classes must use this instead of |
+ // caching the delegate and calling it directly. |
void CertificateSelected(net::X509Certificate* cert); |
+ // Cancels the certificate selection and aborts the request. |
+ void CancelCertificateSelection(); |
+ |
// Begins observing notifications from other SSLClientAuthHandler instances. |
// If another instance chooses a cert for a matching SSLCertRequestInfo, we |
// will also use the same cert and OnCertSelectedByNotification will be called |
@@ -57,7 +66,7 @@ class SSLClientAuthObserver : public content::NotificationObserver { |
const content::BrowserContext* browser_context_; |
scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; |
- base::Callback<void(net::X509Certificate*)> callback_; |
+ scoped_ptr<content::ClientCertificateDelegate> delegate_; |
content::NotificationRegistrar notification_registrar_; |
DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); |