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

Side by Side Diff: net/base/cert_database.h

Issue 6969077: net: Add NET_API to net/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BASE_CERT_DATABASE_H_ 5 #ifndef NET_BASE_CERT_DATABASE_H_
6 #define NET_BASE_CERT_DATABASE_H_ 6 #define NET_BASE_CERT_DATABASE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "net/base/cert_type.h" 15 #include "net/base/cert_type.h"
16 #include "net/base/net_api.h"
16 17
17 namespace net { 18 namespace net {
18 19
19 class CryptoModule; 20 class CryptoModule;
20 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList; 21 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList;
21 class X509Certificate; 22 class X509Certificate;
22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; 23 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
23 24
24 25
25 // This class provides functions to manipulate the local 26 // This class provides functions to manipulate the local
26 // certificate store. 27 // certificate store.
27 28
28 // TODO(gauravsh): This class could be augmented with methods 29 // TODO(gauravsh): This class could be augmented with methods
29 // for all operations that manipulate the underlying system 30 // for all operations that manipulate the underlying system
30 // certificate store. 31 // certificate store.
31 32
32 class CertDatabase { 33 class NET_API CertDatabase {
33 public: 34 public:
34 35
35 // A CertDatabase::Observer will be notified on certificate database changes. 36 // A CertDatabase::Observer will be notified on certificate database changes.
36 // The change could be either a new user certificate is added or trust on 37 // The change could be either a new user certificate is added or trust on
37 // a certificate is changed. Observers can register themselves 38 // a certificate is changed. Observers can register themselves
38 // via CertDatabase::AddObserver, and can un-register with 39 // via CertDatabase::AddObserver, and can un-register with
39 // CertDatabase::RemoveObserver. 40 // CertDatabase::RemoveObserver.
40 class Observer { 41 class NET_API Observer {
41 public: 42 public:
42 virtual ~Observer() {} 43 virtual ~Observer() {}
43 44
44 // Will be called when a new user certificate is added. 45 // Will be called when a new user certificate is added.
45 // Note that |cert| could be NULL when called. 46 // Note that |cert| could be NULL when called.
46 virtual void OnUserCertAdded(const X509Certificate* cert) {} 47 virtual void OnUserCertAdded(const X509Certificate* cert) {}
47 48
48 // Will be called when a certificate's trust is changed. 49 // Will be called when a certificate's trust is changed.
49 // Note that |cert| could be NULL when called. 50 // Note that |cert| could be NULL when called.
50 virtual void OnCertTrustChanged(const X509Certificate* cert) {} 51 virtual void OnCertTrustChanged(const X509Certificate* cert) {}
51 52
52 protected: 53 protected:
53 Observer() {} 54 Observer() {}
54 55
55 private: 56 private:
56 DISALLOW_COPY_AND_ASSIGN(Observer); 57 DISALLOW_COPY_AND_ASSIGN(Observer);
57 }; 58 };
58 59
59 // Stores per-certificate error codes for import failures. 60 // Stores per-certificate error codes for import failures.
60 struct ImportCertFailure { 61 struct NET_API ImportCertFailure {
61 public: 62 public:
62 ImportCertFailure(X509Certificate* cert, int err); 63 ImportCertFailure(X509Certificate* cert, int err);
63 ~ImportCertFailure(); 64 ~ImportCertFailure();
64 65
65 scoped_refptr<X509Certificate> certificate; 66 scoped_refptr<X509Certificate> certificate;
66 int net_error; 67 int net_error;
67 }; 68 };
68 typedef std::vector<ImportCertFailure> ImportCertFailureList; 69 typedef std::vector<ImportCertFailure> ImportCertFailureList;
69 70
70 // Constants that define which usages a certificate is trusted for. 71 // Constants that define which usages a certificate is trusted for.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Broadcasts notifications to all registered observers. 184 // Broadcasts notifications to all registered observers.
184 static void NotifyObserversOfUserCertAdded(const X509Certificate* cert); 185 static void NotifyObserversOfUserCertAdded(const X509Certificate* cert);
185 static void NotifyObserversOfCertTrustChanged(const X509Certificate* cert); 186 static void NotifyObserversOfCertTrustChanged(const X509Certificate* cert);
186 187
187 DISALLOW_COPY_AND_ASSIGN(CertDatabase); 188 DISALLOW_COPY_AND_ASSIGN(CertDatabase);
188 }; 189 };
189 190
190 } // namespace net 191 } // namespace net
191 192
192 #endif // NET_BASE_CERT_DATABASE_H_ 193 #endif // NET_BASE_CERT_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698