Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: chrome/browser/certificate_manager_model.h

Issue 209263002: Merge 257570 "Handle cases when user cert database has NULL slots" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1847/src/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/certificate_manager_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 // Whether the certificate database has a public slot associated with the
155 // profile. If not set, importing certificates is not allowed with this model.
156 bool is_user_db_available_;
151 bool is_tpm_available_; 157 bool is_tpm_available_;
152 158
153 // The observer to notify when certificate list is refreshed. 159 // The observer to notify when certificate list is refreshed.
154 Observer* observer_; 160 Observer* observer_;
155 161
156 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel); 162 DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel);
157 }; 163 };
158 164
159 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ 165 #endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/certificate_manager_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698