OLD | NEW |
1 // Copyright (c) 2011 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 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // imported. | 74 // imported. |
75 bool ImportCACerts(const net::CertificateList& certificates, | 75 bool ImportCACerts(const net::CertificateList& certificates, |
76 net::CertDatabase::TrustBits trust_bits, | 76 net::CertDatabase::TrustBits trust_bits, |
77 net::CertDatabase::ImportCertFailureList* not_imported); | 77 net::CertDatabase::ImportCertFailureList* not_imported); |
78 | 78 |
79 // Import server certificate. The first cert should be the server cert. Any | 79 // Import server certificate. The first cert should be the server cert. Any |
80 // additional certs should be intermediate/CA certs and will be imported but | 80 // additional certs should be intermediate/CA certs and will be imported but |
81 // not given any trust. | 81 // not given any trust. |
82 // Any certificates that could not be imported will be listed in | 82 // Any certificates that could not be imported will be listed in |
83 // |not_imported|. | 83 // |not_imported|. |
| 84 // |trust_bits| can be set to explicitly trust or distrust the certificate, or |
| 85 // use UNTRUSTED to inherit trust as normal. |
84 // Returns false if there is an internal error, otherwise true is returned and | 86 // Returns false if there is an internal error, otherwise true is returned and |
85 // |not_imported| should be checked for any certificates that were not | 87 // |not_imported| should be checked for any certificates that were not |
86 // imported. | 88 // imported. |
87 bool ImportServerCert( | 89 bool ImportServerCert( |
88 const net::CertificateList& certificates, | 90 const net::CertificateList& certificates, |
| 91 net::CertDatabase::TrustBits trust_bits, |
89 net::CertDatabase::ImportCertFailureList* not_imported); | 92 net::CertDatabase::ImportCertFailureList* not_imported); |
90 | 93 |
91 // Set trust values for certificate. | 94 // Set trust values for certificate. |
92 // |trust_bits| should be a bit field of TRUST_* values from CertDatabase, or | 95 // |trust_bits| should be a bit field of TRUST_* values from CertDatabase, or |
93 // UNTRUSTED. | 96 // UNTRUSTED. |
94 // Returns true on success or false on failure. | 97 // Returns true on success or false on failure. |
95 bool SetCertTrust(const net::X509Certificate* cert, | 98 bool SetCertTrust(const net::X509Certificate* cert, |
96 net::CertType type, | 99 net::CertType type, |
97 net::CertDatabase::TrustBits trust_bits); | 100 net::CertDatabase::TrustBits trust_bits); |
98 | 101 |
99 // Delete the cert. Returns true on success. |cert| is still valid when this | 102 // Delete the cert. Returns true on success. |cert| is still valid when this |
100 // function returns. | 103 // function returns. |
101 bool Delete(net::X509Certificate* cert); | 104 bool Delete(net::X509Certificate* cert); |
102 | 105 |
103 private: | 106 private: |
104 // Callback used by Refresh() for when the cert slots have been unlocked. | 107 // Callback used by Refresh() for when the cert slots have been unlocked. |
105 // This method does the actual refreshing. | 108 // This method does the actual refreshing. |
106 void RefreshSlotsUnlocked(); | 109 void RefreshSlotsUnlocked(); |
107 | 110 |
108 net::CertDatabase cert_db_; | 111 net::CertDatabase cert_db_; |
109 net::CertificateList cert_list_; | 112 net::CertificateList cert_list_; |
110 | 113 |
111 // The observer to notify when certificate list is refreshed. | 114 // The observer to notify when certificate list is refreshed. |
112 Observer* observer_; | 115 Observer* observer_; |
113 | 116 |
114 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); | 117 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); |
115 }; | 118 }; |
116 | 119 |
117 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 120 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
OLD | NEW |