diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 17:47:02 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-02 17:47:02 +0000 |
commit | cdafbff7b3e83702c20b0f754a6d27159b78c06c (patch) | |
tree | 5b66619f7822e7189e8cc3287365ed49808d3c72 /chrome/browser/ssl/ssl_add_cert_handler.h | |
parent | 078a10a1c64458e5f5c4fdf57edbbc935dd145ca (diff) | |
download | chromium_src-cdafbff7b3e83702c20b0f754a6d27159b78c06c.zip chromium_src-cdafbff7b3e83702c20b0f754a6d27159b78c06c.tar.gz chromium_src-cdafbff7b3e83702c20b0f754a6d27159b78c06c.tar.bz2 |
Mac: implement <keygen> support, including adding generated cert to the Keychain.
BUG=34607
TEST=KeygenHandlerTest.SmokeTest
Review URL: http://codereview.chromium.org/652137
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ssl/ssl_add_cert_handler.h')
-rw-r--r-- | chrome/browser/ssl/ssl_add_cert_handler.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/chrome/browser/ssl/ssl_add_cert_handler.h b/chrome/browser/ssl/ssl_add_cert_handler.h new file mode 100644 index 0000000..0680128 --- /dev/null +++ b/chrome/browser/ssl/ssl_add_cert_handler.h @@ -0,0 +1,50 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SSL_SSL_ADD_CERT_HANDLER_H_ +#define CHROME_BROWSER_SSL_SSL_ADD_CERT_HANDLER_H_ + +#include "base/basictypes.h" +#include "base/ref_counted.h" +#include "base/string16.h" + +namespace net { +class X509Certificate; +} +class URLRequest; + +// This class handles adding a newly-generated client cert. It ensures there's a +// private key for the cert, displays the cert to the user, and adds it upon +// user approval. +// It is self-owned and deletes itself when finished. +class SSLAddCertHandler : public base::RefCountedThreadSafe<SSLAddCertHandler> { + public: + SSLAddCertHandler(URLRequest* request, net::X509Certificate* cert); + + net::X509Certificate* cert() { return cert_; } + + // The platform-specific code calls this when it's done, to clean up. + // If |addCert| is true, the cert will be added to the CertDatabase. + void Finished(bool add_cert); + + private: + friend class base::RefCountedThreadSafe<SSLAddCertHandler>; + + // Runs the user interface. Called on the UI thread. Calls AskToAddCert. + void RunUI(); + + // Platform-specific code that asks the user whether to add the cert. + // Called on the UI thread. + void AskToAddCert(); + + // Utility to display an error message in a dialog box. + void ShowError(const string16& error); + + // The cert to add. + scoped_refptr<net::X509Certificate> cert_; + + DISALLOW_COPY_AND_ASSIGN(SSLAddCertHandler); +}; + +#endif // CHROME_BROWSER_SSL_SSL_ADD_CERT_HANDLER_H_ |