| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SSL_SSL_ADD_CERT_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_SSL_SSL_ADD_CERT_HANDLER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 | |
| 11 namespace net { | |
| 12 class URLRequest; | |
| 13 class X509Certificate; | |
| 14 } | |
| 15 | |
| 16 // This class handles adding a newly-generated client cert. It ensures there's a | |
| 17 // private key for the cert, displays the cert to the user, and adds it upon | |
| 18 // user approval. | |
| 19 // It is self-owned and deletes itself when finished. | |
| 20 class SSLAddCertHandler : public base::RefCountedThreadSafe<SSLAddCertHandler> { | |
| 21 public: | |
| 22 SSLAddCertHandler(net::URLRequest* request, net::X509Certificate* cert, | |
| 23 int render_process_host_id, int render_view_id); | |
| 24 | |
| 25 net::X509Certificate* cert() { return cert_.get(); } | |
| 26 | |
| 27 int network_request_id() const { return network_request_id_; } | |
| 28 | |
| 29 // The platform-specific code calls this when it's done, to clean up. | |
| 30 // If |addCert| is true, the cert will be added to the CertDatabase. | |
| 31 void Finished(bool add_cert); | |
| 32 | |
| 33 private: | |
| 34 friend class base::RefCountedThreadSafe<SSLAddCertHandler>; | |
| 35 virtual ~SSLAddCertHandler(); | |
| 36 | |
| 37 // Runs the handler. Called on the IO thread. | |
| 38 void Run(); | |
| 39 | |
| 40 // Platform-specific code that asks the user whether to add the cert. | |
| 41 // Called on the UI thread. | |
| 42 void AskToAddCert(); | |
| 43 | |
| 44 // Methods called on the UI thread to call the SSL helper. | |
| 45 void CallVerifyClientCertificateError(int cert_error); | |
| 46 void CallAddClientCertificate(bool add_cert, int cert_error); | |
| 47 | |
| 48 // The cert to add. | |
| 49 scoped_refptr<net::X509Certificate> cert_; | |
| 50 | |
| 51 // The id of the request which started the process. | |
| 52 int network_request_id_; | |
| 53 // The id of the |RenderProcessHost| which started the download. | |
| 54 int render_process_host_id_; | |
| 55 // The id of the |RenderView| which started the download. | |
| 56 int render_view_id_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(SSLAddCertHandler); | |
| 59 }; | |
| 60 | |
| 61 #endif // CHROME_BROWSER_SSL_SSL_ADD_CERT_HANDLER_H_ | |
| OLD | NEW |