| 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 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 15 #include "net/cert/nss_cert_database.h" | 16 #include "net/cert/nss_cert_database.h" |
| 16 | 17 |
| 18 namespace cert_database { |
| 19 class CertDatabaseServiceIOPart; |
| 20 } |
| 21 |
| 17 namespace content { | 22 namespace content { |
| 18 class BrowserContext; | 23 class BrowserContext; |
| 19 class ResourceContext; | 24 class ResourceContext; |
| 20 } // namespace content | 25 } |
| 21 | 26 |
| 22 // CertificateManagerModel provides the data to be displayed in the certificate | 27 // CertificateManagerModel provides the data to be displayed in the certificate |
| 23 // manager dialog, and processes changes from the view. | 28 // manager dialog, and processes changes from the view. |
| 24 class CertificateManagerModel { | 29 class CertificateManagerModel { |
| 25 public: | 30 public: |
| 26 // Map from the subject organization name to the list of certs from that | 31 // Map from the subject organization name to the list of certs from that |
| 27 // organization. If a cert does not have an organization name, the | 32 // organization. If a cert does not have an organization name, the |
| 28 // subject's CertPrincipal::GetDisplayName() value is used instead. | 33 // subject's CertPrincipal::GetDisplayName() value is used instead. |
| 29 typedef std::map<std::string, net::CertificateList> OrgGroupingMap; | 34 typedef std::map<std::string, net::CertificateList> OrgGroupingMap; |
| 30 | 35 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 static void DidGetCertDBOnUIThread( | 139 static void DidGetCertDBOnUIThread( |
| 135 net::NSSCertDatabase* cert_db, | 140 net::NSSCertDatabase* cert_db, |
| 136 bool is_user_db_available, | 141 bool is_user_db_available, |
| 137 bool is_tpm_available, | 142 bool is_tpm_available, |
| 138 CertificateManagerModel::Observer* observer, | 143 CertificateManagerModel::Observer* observer, |
| 139 const CreationCallback& callback); | 144 const CreationCallback& callback); |
| 140 static void DidGetCertDBOnIOThread( | 145 static void DidGetCertDBOnIOThread( |
| 141 CertificateManagerModel::Observer* observer, | 146 CertificateManagerModel::Observer* observer, |
| 142 const CreationCallback& callback, | 147 const CreationCallback& callback, |
| 143 net::NSSCertDatabase* cert_db); | 148 net::NSSCertDatabase* cert_db); |
| 144 static void GetCertDBOnIOThread(content::ResourceContext* context, | 149 static void GetCertDBOnIOThread( |
| 145 CertificateManagerModel::Observer* observer, | 150 base::WeakPtr<cert_database::CertDatabaseServiceIOPart> |
| 146 const CreationCallback& callback); | 151 cert_db_service_io, |
| 152 CertificateManagerModel::Observer* observer, |
| 153 const CreationCallback& callback); |
| 147 | 154 |
| 148 // Callback used by Refresh() for when the cert slots have been unlocked. | 155 // Callback used by Refresh() for when the cert slots have been unlocked. |
| 149 // This method does the actual refreshing. | 156 // This method does the actual refreshing. |
| 150 void RefreshSlotsUnlocked(); | 157 void RefreshSlotsUnlocked(); |
| 151 | 158 |
| 152 net::NSSCertDatabase* cert_db_; | 159 net::NSSCertDatabase* cert_db_; |
| 153 net::CertificateList cert_list_; | 160 net::CertificateList cert_list_; |
| 154 // Whether the certificate database has a public slot associated with the | 161 // Whether the certificate database has a public slot associated with the |
| 155 // profile. If not set, importing certificates is not allowed with this model. | 162 // profile. If not set, importing certificates is not allowed with this model. |
| 156 bool is_user_db_available_; | 163 bool is_user_db_available_; |
| 157 bool is_tpm_available_; | 164 bool is_tpm_available_; |
| 158 | 165 |
| 159 // The observer to notify when certificate list is refreshed. | 166 // The observer to notify when certificate list is refreshed. |
| 160 Observer* observer_; | 167 Observer* observer_; |
| 161 | 168 |
| 162 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); | 169 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); |
| 163 }; | 170 }; |
| 164 | 171 |
| 165 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ | 172 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ |
| OLD | NEW |