diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 21:18:07 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 21:18:07 +0000 |
commit | 06dc32060d502c4341f61847f9f6054a110e15d5 (patch) | |
tree | da4c46e0be11deeb3263c255ae00ce8af6effa7f /chrome/browser/certificate_manager_model.h | |
parent | cc965a7964fbe747a3d8b9de9cd423fa8d13bbfc (diff) | |
download | chromium_src-06dc32060d502c4341f61847f9f6054a110e15d5.zip chromium_src-06dc32060d502c4341f61847f9f6054a110e15d5.tar.gz chromium_src-06dc32060d502c4341f61847f9f6054a110e15d5.tar.bz2 |
DOMUI Certificate Manager: Backup and restore PKCS #12 files. Export certs. Delete certs.
BUG=19991
TEST=manual
Review URL: http://codereview.chromium.org/3556007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61701 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/certificate_manager_model.h')
-rw-r--r-- | chrome/browser/certificate_manager_model.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/chrome/browser/certificate_manager_model.h b/chrome/browser/certificate_manager_model.h index ce45d3a..2598bdf 100644 --- a/chrome/browser/certificate_manager_model.h +++ b/chrome/browser/certificate_manager_model.h @@ -30,10 +30,19 @@ class CertificateManagerModel { COL_EMAIL_ADDRESS, }; - CertificateManagerModel(); + class Observer { + public: + // Called to notify the view that the certificate list has been refreshed. + // TODO(mattm): do a more granular updating strategy? Maybe retrieve new + // list of certs, diff against past list, and then notify of the changes? + virtual void CertificatesRefreshed() = 0; + }; + + explicit CertificateManagerModel(Observer* observer); ~CertificateManagerModel(); - // Refresh the list of certs. Following this call, the view should call + // Refresh the list of certs. Following this call, the observer + // CertificatesRefreshed method will be called so the view can call // FilterAndBuildOrgGroupingMap as necessary to refresh its tree views. void Refresh(); @@ -44,10 +53,27 @@ class CertificateManagerModel { // Get the data to be displayed in |column| for the given |cert|. string16 GetColumnText(const net::X509Certificate& cert, Column column) const; + // Import certificates from PKCS #12 encoded |data|, using the given + // |password|. Returns a net error code on failure. + int ImportFromPKCS12(const std::string& data, const string16& password); + + // Export certificates as PKCS #12 encoded |output|, using the given + // |password|. Returns number of certs exported. + int ExportToPKCS12(const net::CertificateList& certs, + const string16& password, + std::string* output) const; + + // Delete the cert. Returns true on success. |cert| is still valid when this + // function returns. + bool Delete(net::X509Certificate* cert); + private: net::CertDatabase cert_db_; net::CertificateList cert_list_; + // The observer to notify when certificate list is refreshed. + Observer* observer_; + DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); }; |