| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CONTENT_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 5 #ifndef CONTENT_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
| 6 #define CONTENT_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 6 #define CONTENT_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // list of certs, diff against past list, and then notify of the changes? | 36 // list of certs, diff against past list, and then notify of the changes? |
| 37 virtual void CertificatesRefreshed() = 0; | 37 virtual void CertificatesRefreshed() = 0; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 explicit CertificateManagerModel(Observer* observer); | 40 explicit CertificateManagerModel(Observer* observer); |
| 41 ~CertificateManagerModel(); | 41 ~CertificateManagerModel(); |
| 42 | 42 |
| 43 // Accessor for read-only access to the underlying CertDatabase. | 43 // Accessor for read-only access to the underlying CertDatabase. |
| 44 const net::CertDatabase& cert_db() const { return cert_db_; } | 44 const net::CertDatabase& cert_db() const { return cert_db_; } |
| 45 | 45 |
| 46 // Refresh the list of certs. Following this call, the observer | 46 // Trigger a refresh of the list of certs, unlock any slots if necessary. |
| 47 // CertificatesRefreshed method will be called so the view can call | 47 // Following this call, the observer CertificatesRefreshed method will be |
| 48 // FilterAndBuildOrgGroupingMap as necessary to refresh its tree views. | 48 // called so the view can call FilterAndBuildOrgGroupingMap as necessary to |
| 49 // refresh its tree views. |
| 49 void Refresh(); | 50 void Refresh(); |
| 50 | 51 |
| 51 // Fill |map| with the certificates matching |filter_type|. | 52 // Fill |map| with the certificates matching |filter_type|. |
| 52 void FilterAndBuildOrgGroupingMap(net::CertType filter_type, | 53 void FilterAndBuildOrgGroupingMap(net::CertType filter_type, |
| 53 OrgGroupingMap* map) const; | 54 OrgGroupingMap* map) const; |
| 54 | 55 |
| 55 // Get the data to be displayed in |column| for the given |cert|. | 56 // Get the data to be displayed in |column| for the given |cert|. |
| 56 string16 GetColumnText(const net::X509Certificate& cert, Column column) const; | 57 string16 GetColumnText(const net::X509Certificate& cert, Column column) const; |
| 57 | 58 |
| 58 // Import certificates from PKCS #12 encoded |data|, using the given | 59 // Import certificates from PKCS #12 encoded |data|, using the given |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Returns true on success or false on failure. | 92 // Returns true on success or false on failure. |
| 92 bool SetCertTrust(const net::X509Certificate* cert, | 93 bool SetCertTrust(const net::X509Certificate* cert, |
| 93 net::CertType type, | 94 net::CertType type, |
| 94 unsigned int trust_bits); | 95 unsigned int trust_bits); |
| 95 | 96 |
| 96 // Delete the cert. Returns true on success. |cert| is still valid when this | 97 // Delete the cert. Returns true on success. |cert| is still valid when this |
| 97 // function returns. | 98 // function returns. |
| 98 bool Delete(net::X509Certificate* cert); | 99 bool Delete(net::X509Certificate* cert); |
| 99 | 100 |
| 100 private: | 101 private: |
| 102 // Callback used by Refresh() for when the cert slots have been unlocked. |
| 103 // This method does the actual refreshing. |
| 104 void RefreshSlotsUnlocked(); |
| 105 |
| 101 net::CertDatabase cert_db_; | 106 net::CertDatabase cert_db_; |
| 102 net::CertificateList cert_list_; | 107 net::CertificateList cert_list_; |
| 103 | 108 |
| 104 // The observer to notify when certificate list is refreshed. | 109 // The observer to notify when certificate list is refreshed. |
| 105 Observer* observer_; | 110 Observer* observer_; |
| 106 | 111 |
| 107 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); | 112 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 #endif // CONTENT_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 115 #endif // CONTENT_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
| OLD | NEW |