Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Unified Diff: chrome/browser/ssl/ssl_client_auth_observer.h

Issue 859213006: Cancel client auth requests when not promptable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client-auth-cancel-1
Patch Set: worker_common.js was missing a license header (also a rebase) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « chrome/browser/extensions/background_xhr_browsertest.cc ('k') | chrome/browser/ssl/ssl_client_auth_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698