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

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

Issue 111273002: NSSCertDatabaseChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gcc fix Created 7 years 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
(Empty)
1 // Copyright (c) 2013 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.
4
5 #ifndef NET_CERT_NSS_CERT_DATABASE_CHROMEOS_
6 #define NET_CERT_NSS_CERT_DATABASE_CHROMEOS_
7
8 #include "base/callback.h"
9 #include "crypto/scoped_nss_types.h"
10 #include "net/cert/nss_cert_database.h"
11 #include "net/cert/nss_profile_filter_chromeos.h"
12
13 namespace net {
14
15 class ScopedTestNSSCertDatabaseChromeOS;
16
17 class NET_EXPORT NSSCertDatabaseChromeOS : public NSSCertDatabase {
18 public:
19 // Get a pointer to the NSSCertDatabase for the given user. Ownership is not
20 // transferred, but the caller may save the pointer, which will remain valid
21 // for the lifetime of the process. If the database is already initialized it
22 // will be returned, otherwise if |callback| is non-null, the database will be
23 // passed to the callback when it is ready.
24 static NSSCertDatabase* GetForUser(
25 const std::string& username_hash,
26 const base::Callback<void(NSSCertDatabase*)>& callback);
27
28 virtual ~NSSCertDatabaseChromeOS();
29
30 // NSSCertDatabase implementation.
31 virtual void ListCerts(CertificateList* certs) OVERRIDE;
32 virtual crypto::ScopedPK11Slot GetPublicSlot() const OVERRIDE;
33 virtual crypto::ScopedPK11Slot GetPrivateSlot() const OVERRIDE;
34 virtual void ListModules(CryptoModuleList* modules, bool need_rw) const
35 OVERRIDE;
36
37 // TODO(mattm): handle trust setting, deletion, etc correctly when certs exist
38 // in multiple slots.
39 // TODO(mattm): handle trust setting correctly for certs in read-only slots.
40
41 class Manager;
42 friend class Manager;
43
44 private:
45 // This class should not be constructed directly. Use GetForUser().
46 explicit NSSCertDatabaseChromeOS(crypto::ScopedPK11Slot public_slot);
47
48 void SetPrivateSlot(crypto::ScopedPK11Slot private_slot);
49 void OnReady(const base::Callback<void(NSSCertDatabase*)>& callback);
50
51 // Exposed for unittests only.
52 friend class ScopedTestNSSCertDatabaseChromeOS;
53 static void RemoveUserForTesting(const std::string& username_hash);
54
55 bool ready_;
56 crypto::ScopedPK11Slot public_slot_;
57 crypto::ScopedPK11Slot private_slot_;
58 NSSProfileFilterChromeOS profile_filter_;
59
60 typedef std::vector<base::Callback<void(NSSCertDatabase*)> >
61 ReadyCallbackList;
62 ReadyCallbackList ready_callback_list_;
63
64 DISALLOW_COPY_AND_ASSIGN(NSSCertDatabaseChromeOS);
65 };
66
67 } // namespace net
68
69 #endif // NET_CERT_NSS_CERT_DATABASE_CHROMEOS_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698