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

Side by Side Diff: content/browser/ssl/ssl_client_auth_handler.h

Issue 9384014: Remove knowledge about SSLClientAuthHandler from chrome. Instead a callback is given to the embed... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments+sync Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
6 #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ 6 #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/message_loop_helpers.h" 11 #include "base/message_loop_helpers.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16 #include "net/base/ssl_cert_request_info.h" 14 #include "net/base/ssl_cert_request_info.h"
17 15
18 namespace net { 16 namespace net {
19 class HttpNetworkSession; 17 class HttpNetworkSession;
20 class URLRequest; 18 class URLRequest;
21 class X509Certificate; 19 class X509Certificate;
22 } // namespace net 20 } // namespace net
23 21
24 // This class handles the approval and selection of a certificate for SSL client 22 // This class handles the approval and selection of a certificate for SSL client
25 // authentication by the user. 23 // authentication by the user.
(...skipping 12 matching lines...) Expand all
38 36
39 // Invoked when the request associated with this handler is cancelled. 37 // Invoked when the request associated with this handler is cancelled.
40 // Should only be called on the IO thread. 38 // Should only be called on the IO thread.
41 void OnRequestCancelled(); 39 void OnRequestCancelled();
42 40
43 // Calls DoCertificateSelected on the I/O thread. 41 // Calls DoCertificateSelected on the I/O thread.
44 // Called on the UI thread after the user has made a selection (which may 42 // Called on the UI thread after the user has made a selection (which may
45 // be long after DoSelectCertificate returns, if the UI is modeless/async.) 43 // be long after DoSelectCertificate returns, if the UI is modeless/async.)
46 void CertificateSelected(net::X509Certificate* cert); 44 void CertificateSelected(net::X509Certificate* cert);
47 45
48 // Like CertificateSelected, but does not send SSL_CLIENT_AUTH_CERT_SELECTED
49 // notification. Used to avoid notification re-spamming when other
50 // certificate selectors act on a notification matching the same host.
51 virtual void CertificateSelectedNoNotify(net::X509Certificate* cert);
52
53 // Returns the SSLCertRequestInfo for this handler.
54 net::SSLCertRequestInfo* cert_request_info() { return cert_request_info_; }
55
56 // Returns the session the URL request is associated with.
57 const net::HttpNetworkSession* http_network_session() const {
58 return http_network_session_;
59 }
60
61 protected: 46 protected:
62 virtual ~SSLClientAuthHandler(); 47 virtual ~SSLClientAuthHandler();
63 48
64 private: 49 private:
65 friend class base::RefCountedThreadSafe< 50 friend class base::RefCountedThreadSafe<
66 SSLClientAuthHandler, content::BrowserThread::DeleteOnIOThread>; 51 SSLClientAuthHandler, content::BrowserThread::DeleteOnIOThread>;
67 friend class content::BrowserThread; 52 friend class content::BrowserThread;
68 friend class base::DeleteHelper<SSLClientAuthHandler>; 53 friend class base::DeleteHelper<SSLClientAuthHandler>;
69 54
70 // Notifies that the user has selected a cert. 55 // Notifies that the user has selected a cert.
71 // Called on the IO thread. 56 // Called on the IO thread.
72 void DoCertificateSelected(net::X509Certificate* cert); 57 void DoCertificateSelected(net::X509Certificate* cert);
73 58
74 // Selects a client certificate on the UI thread. 59 // Selects a client certificate on the UI thread.
75 void DoSelectCertificate(int render_process_host_id, 60 void DoSelectCertificate(int render_process_host_id,
76 int render_view_host_id); 61 int render_view_host_id);
77 62
78 // The net::URLRequest that triggered this client auth. 63 // The net::URLRequest that triggered this client auth.
79 net::URLRequest* request_; 64 net::URLRequest* request_;
80 65
81 // The HttpNetworkSession |request_| is associated with. 66 // The HttpNetworkSession |request_| is associated with.
82 const net::HttpNetworkSession* http_network_session_; 67 const net::HttpNetworkSession* http_network_session_;
83 68
84 // The certs to choose from. 69 // The certs to choose from.
85 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_; 70 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
86 71
87 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler); 72 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler);
88 }; 73 };
89 74
90 class CONTENT_EXPORT SSLClientAuthObserver
91 : public content::NotificationObserver {
92 public:
93 SSLClientAuthObserver(net::SSLCertRequestInfo* cert_request_info,
94 SSLClientAuthHandler* handler);
95 virtual ~SSLClientAuthObserver();
96
97 // UI should implement this to close the dialog.
98 virtual void OnCertSelectedByNotification() = 0;
99
100 // content::NotificationObserver implementation:
101 virtual void Observe(int type,
102 const content::NotificationSource& source,
103 const content::NotificationDetails& details) OVERRIDE;
104
105 // Begins observing notifications from other SSLClientAuthHandler instances.
106 // If another instance chooses a cert for a matching SSLCertRequestInfo, we
107 // will also use the same cert and OnCertSelectedByNotification will be called
108 // so that the cert selection UI can be closed.
109 void StartObserving();
110
111 // Stops observing notifications. We will no longer act on client auth
112 // notifications.
113 void StopObserving();
114
115 private:
116 scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
117
118 scoped_refptr<SSLClientAuthHandler> handler_;
119
120 content::NotificationRegistrar notification_registrar_;
121
122 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver);
123 };
124
125 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ 75 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/mock_content_browser_client.cc ('k') | content/browser/ssl/ssl_client_auth_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698