OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 5 #ifndef CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
6 #define CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 6 #define CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 | 49 |
50 // Creates a CertificateManagerModel. The model will be passed to the callback | 50 // Creates a CertificateManagerModel. The model will be passed to the callback |
51 // when it is ready. The caller must ensure the model does not outlive the | 51 // when it is ready. The caller must ensure the model does not outlive the |
52 // |browser_context|. | 52 // |browser_context|. |
53 static void Create(content::BrowserContext* browser_context, | 53 static void Create(content::BrowserContext* browser_context, |
54 Observer* observer, | 54 Observer* observer, |
55 const CreationCallback& callback); | 55 const CreationCallback& callback); |
56 | 56 |
57 ~CertificateManagerModel(); | 57 ~CertificateManagerModel(); |
58 | 58 |
59 bool is_user_db_available() const { return is_user_db_available_; } | |
59 bool is_tpm_available() const { return is_tpm_available_; } | 60 bool is_tpm_available() const { return is_tpm_available_; } |
60 | 61 |
61 // Accessor for read-only access to the underlying NSSCertDatabase. | 62 // Accessor for read-only access to the underlying NSSCertDatabase. |
62 const net::NSSCertDatabase* cert_db() const { return cert_db_; } | 63 const net::NSSCertDatabase* cert_db() const { return cert_db_; } |
63 | 64 |
64 // Trigger a refresh of the list of certs, unlock any slots if necessary. | 65 // Trigger a refresh of the list of certs, unlock any slots if necessary. |
65 // Following this call, the observer CertificatesRefreshed method will be | 66 // Following this call, the observer CertificatesRefreshed method will be |
66 // called so the view can call FilterAndBuildOrgGroupingMap as necessary to | 67 // called so the view can call FilterAndBuildOrgGroupingMap as necessary to |
67 // refresh its tree views. | 68 // refresh its tree views. |
68 void Refresh(); | 69 void Refresh(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 | 118 |
118 // Delete the cert. Returns true on success. |cert| is still valid when this | 119 // Delete the cert. Returns true on success. |cert| is still valid when this |
119 // function returns. | 120 // function returns. |
120 bool Delete(net::X509Certificate* cert); | 121 bool Delete(net::X509Certificate* cert); |
121 | 122 |
122 // IsHardwareBacked returns true if |cert| is hardware backed. | 123 // IsHardwareBacked returns true if |cert| is hardware backed. |
123 bool IsHardwareBacked(const net::X509Certificate* cert) const; | 124 bool IsHardwareBacked(const net::X509Certificate* cert) const; |
124 | 125 |
125 private: | 126 private: |
126 CertificateManagerModel(net::NSSCertDatabase* nss_cert_database, | 127 CertificateManagerModel(net::NSSCertDatabase* nss_cert_database, |
128 bool is_user_db_available, | |
127 bool is_tpm_available, | 129 bool is_tpm_available, |
128 Observer* observer); | 130 Observer* observer); |
129 | 131 |
130 // Methods used during initialization, see the comment at the top of the .cc | 132 // Methods used during initialization, see the comment at the top of the .cc |
131 // file for details. | 133 // file for details. |
132 static void DidGetCertDBOnUIThread( | 134 static void DidGetCertDBOnUIThread( |
133 net::NSSCertDatabase* cert_db, | 135 net::NSSCertDatabase* cert_db, |
136 bool is_user_db_available, | |
134 bool is_tpm_available, | 137 bool is_tpm_available, |
135 CertificateManagerModel::Observer* observer, | 138 CertificateManagerModel::Observer* observer, |
136 const CreationCallback& callback); | 139 const CreationCallback& callback); |
137 static void DidGetCertDBOnIOThread( | 140 static void DidGetCertDBOnIOThread( |
138 CertificateManagerModel::Observer* observer, | 141 CertificateManagerModel::Observer* observer, |
139 const CreationCallback& callback, | 142 const CreationCallback& callback, |
140 net::NSSCertDatabase* cert_db); | 143 net::NSSCertDatabase* cert_db); |
141 static void GetCertDBOnIOThread(content::ResourceContext* context, | 144 static void GetCertDBOnIOThread(content::ResourceContext* context, |
142 CertificateManagerModel::Observer* observer, | 145 CertificateManagerModel::Observer* observer, |
143 const CreationCallback& callback); | 146 const CreationCallback& callback); |
144 | 147 |
145 // Callback used by Refresh() for when the cert slots have been unlocked. | 148 // Callback used by Refresh() for when the cert slots have been unlocked. |
146 // This method does the actual refreshing. | 149 // This method does the actual refreshing. |
147 void RefreshSlotsUnlocked(); | 150 void RefreshSlotsUnlocked(); |
148 | 151 |
149 net::NSSCertDatabase* cert_db_; | 152 net::NSSCertDatabase* cert_db_; |
150 net::CertificateList cert_list_; | 153 net::CertificateList cert_list_; |
154 bool is_user_db_available_; | |
James Hawkins
2014/03/17 18:58:22
It's not clear to me from the variable name exactl
tbarzic
2014/03/17 19:17:38
Done, hope it's clearer now.
| |
151 bool is_tpm_available_; | 155 bool is_tpm_available_; |
152 | 156 |
153 // The observer to notify when certificate list is refreshed. | 157 // The observer to notify when certificate list is refreshed. |
154 Observer* observer_; | 158 Observer* observer_; |
155 | 159 |
156 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); | 160 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); |
157 }; | 161 }; |
158 | 162 |
159 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 163 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
OLD | NEW |