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

Unified Diff: chrome/browser/certificate_manager_model.h

Issue 18121007: *WIP* Store NSS slots per profile. Move keygen to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: certdb: handle GetCertTrust and IsUntrusted, failed attempt to handle SetCertTrust Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/certificate_manager_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/certificate_manager_model.h
diff --git a/chrome/browser/certificate_manager_model.h b/chrome/browser/certificate_manager_model.h
index c0ffb76b3f1658b32384b67223dcc977d59bdef4..c700d6f7f7ce16f4da2c7f9ebd2a03acc396f009 100644
--- a/chrome/browser/certificate_manager_model.h
+++ b/chrome/browser/certificate_manager_model.h
@@ -9,9 +9,14 @@
#include <string>
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "net/cert/nss_cert_database.h"
+namespace content {
+class BrowserContext;
+} // namespace content
+
// CertificateManagerModel provides the data to be displayed in the certificate
// manager dialog, and processes changes from the view.
class CertificateManagerModel {
@@ -31,15 +36,23 @@ class CertificateManagerModel {
class Observer {
public:
+ // Called once the initializiation is complete and cert_db() is non-NULL.
+ virtual void CertificateManagerModelReady() = 0;
+
// 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);
+ // Create the CertificateManagerModel. Caller should wait until
+ // |observer->CertificateManagerModelReady| has been called before using.
+ CertificateManagerModel(content::BrowserContext* browser_context,
+ Observer* observer);
~CertificateManagerModel();
+ bool is_ready() const { return cert_db_; }
+
// Accessor for read-only access to the underlying NSSCertDatabase.
const net::NSSCertDatabase* cert_db() const { return cert_db_; }
@@ -107,6 +120,9 @@ class CertificateManagerModel {
bool IsHardwareBacked(const net::X509Certificate* cert) const;
private:
+ // We got the cert database corresponding to the BrowserContext.
+ void GotCertDB(net::NSSCertDatabase* cert_db);
+
// Callback used by Refresh() for when the cert slots have been unlocked.
// This method does the actual refreshing.
void RefreshSlotsUnlocked();
@@ -117,6 +133,8 @@ class CertificateManagerModel {
// The observer to notify when certificate list is refreshed.
Observer* observer_;
+ base::WeakPtrFactory<CertificateManagerModel> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel);
};
« no previous file with comments | « no previous file | chrome/browser/certificate_manager_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698