| 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);
|
| };
|
|
|
|
|