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

Side by Side Diff: net/cert/nss_cert_database.h

Issue 2691683003: Remove OnCertDBChanged |cert| parameter. (Closed)
Patch Set: comment wording Created 3 years, 10 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
« no previous file with comments | « net/cert/cert_database_mac.cc ('k') | net/cert/nss_cert_database.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 NET_CERT_NSS_CERT_DATABASE_H_ 5 #ifndef NET_CERT_NSS_CERT_DATABASE_H_
6 #define NET_CERT_NSS_CERT_DATABASE_H_ 6 #define NET_CERT_NSS_CERT_DATABASE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 23 matching lines...) Expand all
34 34
35 // Provides functions to manipulate the NSS certificate stores. 35 // Provides functions to manipulate the NSS certificate stores.
36 // Forwards notifications about certificate changes to the global CertDatabase 36 // Forwards notifications about certificate changes to the global CertDatabase
37 // singleton. 37 // singleton.
38 class NET_EXPORT NSSCertDatabase { 38 class NET_EXPORT NSSCertDatabase {
39 public: 39 public:
40 class NET_EXPORT Observer { 40 class NET_EXPORT Observer {
41 public: 41 public:
42 virtual ~Observer() {} 42 virtual ~Observer() {}
43 43
44 // Will be called when a CA certificate is changed. 44 // Will be called when a certificate is added, removed, or trust settings
45 // Called with |cert| == NULL after importing a list of certificates 45 // are changed.
46 // in ImportCACerts(). 46 virtual void OnCertDBChanged() {}
47 virtual void OnCertDBChanged(const X509Certificate* cert) {}
48 47
49 protected: 48 protected:
50 Observer() {} 49 Observer() {}
51 50
52 private: 51 private:
53 DISALLOW_COPY_AND_ASSIGN(Observer); 52 DISALLOW_COPY_AND_ASSIGN(Observer);
54 }; 53 };
55 54
56 // Stores per-certificate error codes for import failures. 55 // Stores per-certificate error codes for import failures.
57 struct NET_EXPORT ImportCertFailure { 56 struct NET_EXPORT ImportCertFailure {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 protected: 238 protected:
240 // Certificate listing implementation used by |ListCerts*| and 239 // Certificate listing implementation used by |ListCerts*| and
241 // |ListCertsSync|. Static so it may safely be used on the worker thread. 240 // |ListCertsSync|. Static so it may safely be used on the worker thread.
242 // If |slot| is NULL, obtains the certs of all slots, otherwise only of 241 // If |slot| is NULL, obtains the certs of all slots, otherwise only of
243 // |slot|. 242 // |slot|.
244 static void ListCertsImpl(crypto::ScopedPK11Slot slot, 243 static void ListCertsImpl(crypto::ScopedPK11Slot slot,
245 CertificateList* certs); 244 CertificateList* certs);
246 245
247 protected: 246 protected:
248 // Broadcasts notifications to all registered observers. 247 // Broadcasts notifications to all registered observers.
249 void NotifyObserversCertDBChanged(const X509Certificate* cert); 248 void NotifyObserversCertDBChanged();
250 249
251 private: 250 private:
252 // Registers |observer| to receive notifications of certificate changes. The 251 // Registers |observer| to receive notifications of certificate changes. The
253 // thread on which this is called is the thread on which |observer| will be 252 // thread on which this is called is the thread on which |observer| will be
254 // called back with notifications. 253 // called back with notifications.
255 // NOTE: Observers registered here will only receive notifications generated 254 // NOTE: Observers registered here will only receive notifications generated
256 // directly through the NSSCertDatabase, but not those from the CertDatabase. 255 // directly through the NSSCertDatabase, but not those from the CertDatabase.
257 // CertDatabase observers will receive all certificate notifications. 256 // CertDatabase observers will receive all certificate notifications.
258 void AddObserver(Observer* observer); 257 void AddObserver(Observer* observer);
259 258
260 // Unregisters |observer| from receiving notifications. This must be called 259 // Unregisters |observer| from receiving notifications. This must be called
261 // on the same thread on which AddObserver() was called. 260 // on the same thread on which AddObserver() was called.
262 void RemoveObserver(Observer* observer); 261 void RemoveObserver(Observer* observer);
263 262
264 // Notifies observers of the removal of |cert| and calls |callback| with 263 // Notifies observers of the removal of a cert and calls |callback| with
265 // |success| as argument. 264 // |success| as argument.
266 void NotifyCertRemovalAndCallBack(scoped_refptr<X509Certificate> cert, 265 void NotifyCertRemovalAndCallBack(const DeleteCertCallback& callback,
267 const DeleteCertCallback& callback,
268 bool success); 266 bool success);
269 267
270 // Certificate removal implementation used by |DeleteCertAndKey*|. Static so 268 // Certificate removal implementation used by |DeleteCertAndKey*|. Static so
271 // it may safely be used on the worker thread. 269 // it may safely be used on the worker thread.
272 static bool DeleteCertAndKeyImpl(scoped_refptr<X509Certificate> cert); 270 static bool DeleteCertAndKeyImpl(scoped_refptr<X509Certificate> cert);
273 271
274 crypto::ScopedPK11Slot public_slot_; 272 crypto::ScopedPK11Slot public_slot_;
275 crypto::ScopedPK11Slot private_slot_; 273 crypto::ScopedPK11Slot private_slot_;
276 274
277 // A helper observer that forwards events from this database to CertDatabase. 275 // A helper observer that forwards events from this database to CertDatabase.
278 std::unique_ptr<Observer> cert_notification_forwarder_; 276 std::unique_ptr<Observer> cert_notification_forwarder_;
279 277
280 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_; 278 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_;
281 279
282 base::WeakPtrFactory<NSSCertDatabase> weak_factory_; 280 base::WeakPtrFactory<NSSCertDatabase> weak_factory_;
283 281
284 DISALLOW_COPY_AND_ASSIGN(NSSCertDatabase); 282 DISALLOW_COPY_AND_ASSIGN(NSSCertDatabase);
285 }; 283 };
286 284
287 } // namespace net 285 } // namespace net
288 286
289 #endif // NET_CERT_NSS_CERT_DATABASE_H_ 287 #endif // NET_CERT_NSS_CERT_DATABASE_H_
OLDNEW
« no previous file with comments | « net/cert/cert_database_mac.cc ('k') | net/cert/nss_cert_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698