Adds a reset button to the zoom bubble on GTK.
[chromium-blink-merge.git] / net / base / cert_database.cc
blob7930750757de371ef6df10bfbffbeb98da1cf4cb
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
3 // found in the LICENSE file.
5 #include "net/base/cert_database.h"
7 #include "base/memory/singleton.h"
8 #include "base/observer_list_threadsafe.h"
10 namespace net {
12 CertDatabase::ImportCertFailure::ImportCertFailure(
13 X509Certificate* cert, int err)
14 : certificate(cert), net_error(err) {
17 CertDatabase::ImportCertFailure::~ImportCertFailure() {
20 // CertDatabaseNotifier notifies registered observers when new user certificates
21 // are added to the database.
22 class CertDatabaseNotifier {
23 public:
24 CertDatabaseNotifier()
25 : observer_list_(new ObserverListThreadSafe<CertDatabase::Observer>) {
28 static CertDatabaseNotifier* GetInstance() {
29 return Singleton<CertDatabaseNotifier>::get();
32 friend struct DefaultSingletonTraits<CertDatabaseNotifier>;
33 friend class CertDatabase;
35 private:
36 const scoped_refptr<ObserverListThreadSafe<CertDatabase::Observer> >
37 observer_list_;
40 void CertDatabase::AddObserver(Observer* observer) {
41 CertDatabaseNotifier::GetInstance()->observer_list_->AddObserver(observer);
44 void CertDatabase::RemoveObserver(Observer* observer) {
45 CertDatabaseNotifier::GetInstance()->observer_list_->RemoveObserver(observer);
48 void CertDatabase::NotifyObserversOfUserCertAdded(const X509Certificate* cert) {
49 CertDatabaseNotifier::GetInstance()->observer_list_->Notify(
50 &CertDatabase::Observer::OnUserCertAdded, make_scoped_refptr(cert));
53 void CertDatabase::NotifyObserversOfUserCertRemoved(
54 const X509Certificate* cert) {
55 CertDatabaseNotifier::GetInstance()->observer_list_->Notify(
56 &CertDatabase::Observer::OnUserCertRemoved, make_scoped_refptr(cert));
59 void CertDatabase::NotifyObserversOfCertTrustChanged(
60 const X509Certificate* cert) {
61 CertDatabaseNotifier::GetInstance()->observer_list_->Notify(
62 &CertDatabase::Observer::OnCertTrustChanged, make_scoped_refptr(cert));
65 } // namespace net