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

Side by Side Diff: chrome/browser/ssl/ssl_client_auth_observer.h

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: removed no longer needed forward declaration Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_
6 #define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ 6 #define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 15
16 namespace net { 16 namespace net {
17 class SSLCertRequestInfo; 17 class SSLCertRequestInfo;
18 class SSLPrivateKey;
18 class X509Certificate; 19 class X509Certificate;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 class BrowserContext; 23 class BrowserContext;
23 class ClientCertificateDelegate; 24 class ClientCertificateDelegate;
24 } 25 }
25 26
26 // SSLClientAuthObserver is a base class that wraps a 27 // SSLClientAuthObserver is a base class that wraps a
27 // ClientCertificateDelegate. It links client certificate selection dialogs 28 // ClientCertificateDelegate. It links client certificate selection dialogs
28 // attached to the same BrowserContext. When CertificateSelected is called via 29 // attached to the same BrowserContext. When CertificateSelected is called via
29 // one of them, the rest simulate the same action. 30 // one of them, the rest simulate the same action.
30 class SSLClientAuthObserver : public content::NotificationObserver { 31 class SSLClientAuthObserver : public content::NotificationObserver {
31 public: 32 public:
32 SSLClientAuthObserver( 33 SSLClientAuthObserver(
33 const content::BrowserContext* browser_context, 34 const content::BrowserContext* browser_context,
34 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, 35 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
35 std::unique_ptr<content::ClientCertificateDelegate> delegate); 36 std::unique_ptr<content::ClientCertificateDelegate> delegate);
36 ~SSLClientAuthObserver() override; 37 ~SSLClientAuthObserver() override;
37 38
38 // UI should implement this to close the dialog. 39 // UI should implement this to close the dialog.
39 virtual void OnCertSelectedByNotification() = 0; 40 virtual void OnCertSelectedByNotification() = 0;
40 41
41 // Continues the request with a certificate. Can also call with NULL to 42 // Continues the request with a certificate. Can also call with NULL to
42 // continue with no certificate. Derived classes must use this instead of 43 // continue with no certificate. Derived classes must use this instead of
43 // caching the delegate and calling it directly. 44 // caching the delegate and calling it directly.
44 void CertificateSelected(net::X509Certificate* cert); 45 void CertificateSelected(net::X509Certificate* cert,
46 net::SSLPrivateKey* private_key);
45 47
46 // Cancels the certificate selection and aborts the request. 48 // Cancels the certificate selection and aborts the request.
47 void CancelCertificateSelection(); 49 void CancelCertificateSelection();
48 50
49 // Begins observing notifications from other SSLClientAuthHandler instances. 51 // Begins observing notifications from other SSLClientAuthHandler instances.
50 // If another instance chooses a cert for a matching SSLCertRequestInfo, we 52 // If another instance chooses a cert for a matching SSLCertRequestInfo, we
51 // will also use the same cert and OnCertSelectedByNotification will be called 53 // will also use the same cert and OnCertSelectedByNotification will be called
52 // so that the cert selection UI can be closed. 54 // so that the cert selection UI can be closed.
53 void StartObserving(); 55 void StartObserving();
54 56
(...skipping 13 matching lines...) Expand all
68 70
69 const content::BrowserContext* browser_context_; 71 const content::BrowserContext* browser_context_;
70 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; 72 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
71 std::unique_ptr<content::ClientCertificateDelegate> delegate_; 73 std::unique_ptr<content::ClientCertificateDelegate> delegate_;
72 content::NotificationRegistrar notification_registrar_; 74 content::NotificationRegistrar notification_registrar_;
73 75
74 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); 76 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver);
75 }; 77 };
76 78
77 #endif // CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ 79 #endif // CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_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