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

Unified Diff: net/base/cert_database.h

Issue 13006020: net: extract net/cert out of net/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/asn1_util.cc ('k') | net/base/cert_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cert_database.h
diff --git a/net/base/cert_database.h b/net/base/cert_database.h
deleted file mode 100644
index d71a2544ba80717518fa0ff6a03461205b3ebd38..0000000000000000000000000000000000000000
--- a/net/base/cert_database.h
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_BASE_CERT_DATABASE_H_
-#define NET_BASE_CERT_DATABASE_H_
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "net/base/net_export.h"
-#include "net/base/x509_certificate.h"
-
-template <typename T> struct DefaultSingletonTraits;
-template <class ObserverType> class ObserverListThreadSafe;
-
-namespace net {
-
-// This class provides cross-platform functions to verify and add user
-// certificates, and to observe changes to the underlying certificate stores.
-
-// TODO(gauravsh): This class could be augmented with methods
-// for all operations that manipulate the underlying system
-// certificate store.
-
-class NET_EXPORT CertDatabase {
- public:
- // A CertDatabase::Observer will be notified on certificate database changes.
- // The change could be either a new user certificate is added or trust on
- // a certificate is changed. Observers can register themselves
- // via CertDatabase::AddObserver, and can un-register with
- // CertDatabase::RemoveObserver.
- class NET_EXPORT Observer {
- public:
- virtual ~Observer() {}
-
- // Will be called when a new certificate is added.
- virtual void OnCertAdded(const X509Certificate* cert) {}
-
- // Will be called when a certificate is removed.
- virtual void OnCertRemoved(const X509Certificate* cert) {}
-
- // Will be called when a certificate's trust is changed.
- virtual void OnCertTrustChanged(const X509Certificate* cert) {}
-
- protected:
- Observer() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Observer);
- };
-
- // Returns the CertDatabase singleton.
- static CertDatabase* GetInstance();
-
- // Check whether this is a valid user cert that we have the private key for.
- // Returns OK or a network error code such as ERR_CERT_CONTAINS_ERRORS.
- int CheckUserCert(X509Certificate* cert);
-
- // Store user (client) certificate. Assumes CheckUserCert has already passed.
- // Returns OK, or ERR_ADD_USER_CERT_FAILED if there was a problem saving to
- // the platform cert database, or possibly other network error codes.
- int AddUserCert(X509Certificate* cert);
-
- // Registers |observer| to receive notifications of certificate changes. The
- // thread on which this is called is the thread on which |observer| will be
- // called back with notifications.
- void AddObserver(Observer* observer);
-
- // Unregisters |observer| from receiving notifications. This must be called
- // on the same thread on which AddObserver() was called.
- void RemoveObserver(Observer* observer);
-
-#if defined(OS_MACOSX) && !defined(OS_IOS)
- // Configures the current message loop to observe and forward events from
- // Keychain services. The MessageLoop must have an associated CFRunLoop,
- // which means that this must be called from a MessageLoop of TYPE_UI.
- void SetMessageLoopForKeychainEvents();
-#endif
-
- private:
- friend struct DefaultSingletonTraits<CertDatabase>;
-
- CertDatabase();
- ~CertDatabase();
-
- // Broadcasts notifications to all registered observers.
- void NotifyObserversOfCertAdded(const X509Certificate* cert);
- void NotifyObserversOfCertRemoved(const X509Certificate* cert);
- void NotifyObserversOfCertTrustChanged(const X509Certificate* cert);
-
- const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_;
-
-#if defined(USE_NSS) || (defined(OS_MACOSX) && !defined(OS_IOS))
- class Notifier;
- friend class Notifier;
- scoped_ptr<Notifier> notifier_;
-#endif
-
- DISALLOW_COPY_AND_ASSIGN(CertDatabase);
-};
-
-} // namespace net
-
-#endif // NET_BASE_CERT_DATABASE_H_
« no previous file with comments | « net/base/asn1_util.cc ('k') | net/base/cert_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698