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.
5 #ifndef CHROME_BROWSER_NET_NSS_CONTEXT_H_
6 #define CHROME_BROWSER_NET_NSS_CONTEXT_H_
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "crypto/scoped_nss_types.h"
15 class NSSCertDatabase
;
19 class ResourceContext
;
20 } // namespace content
22 // Returns a reference to the public slot for the user associated with
23 // |context|. Should be called only on the IO thread.
24 crypto::ScopedPK11Slot
GetPublicNSSKeySlotForResourceContext(
25 content::ResourceContext
* context
);
27 // Returns a reference to the private slot for the user associated with
28 // |context|, if it is loaded. If it is not loaded and |callback| is non-null,
29 // the |callback| will be run once the slot is loaded.
30 // Should be called only on the IO thread.
31 crypto::ScopedPK11Slot
GetPrivateNSSKeySlotForResourceContext(
32 content::ResourceContext
* context
,
33 const base::Callback
<void(crypto::ScopedPK11Slot
)>& callback
)
36 // Returns a pointer to the NSSCertDatabase for the user associated with
37 // |context|, if it is ready. If it is not ready and |callback| is non-null, the
38 // |callback| will be run once the DB is initialized. Ownership is not
39 // transferred, but the caller may save the pointer, which will remain valid for
40 // the lifetime of the ResourceContext.
41 // Should be called only on the IO thread.
42 net::NSSCertDatabase
* GetNSSCertDatabaseForResourceContext(
43 content::ResourceContext
* context
,
44 const base::Callback
<void(net::NSSCertDatabase
*)>& callback
)
47 #endif // CHROME_BROWSER_NET_NSS_CONTEXT_H_