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

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: more refactoring Created 7 years 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 9467c59569954aa833fb6883405e867de7c39e69..d65e06c0a34d2e648b1db244de347623cf849b65 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_; }
@@ -105,6 +118,9 @@ class CertificateManagerModel {
bool IsHardwareBacked(const net::X509Certificate* cert) const;
private:
+ // We got the cert database corresponding to the BrowserContext.
+ void DidGetCertDB(net::NSSCertDatabase* cert_db);
+
// Callback used by Refresh() for when the cert slots have been unlocked.
// This method does the actual refreshing.
void RefreshSlotsUnlocked();
@@ -115,6 +131,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