blob: 53eab54cc7dc3980395d1d1aa374ba4858c5696a [file] [log] [blame]
[email protected]557737f72013-12-06 22:24:071// 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 CHROME_BROWSER_NET_NSS_CONTEXT_H_
6#define CHROME_BROWSER_NET_NSS_CONTEXT_H_
7
8#include <string>
9
10#include "base/callback.h"
11#include "base/compiler_specific.h"
12#include "crypto/scoped_nss_types.h"
13
[email protected]057ad5f2013-12-20 19:00:5714namespace net {
15class NSSCertDatabase;
16}
17
[email protected]557737f72013-12-06 22:24:0718namespace content {
19class ResourceContext;
20} // namespace content
21
22// Returns a reference to the public slot for the user associated with
23// |context|. Should be called only on the IO thread.
24crypto::ScopedPK11Slot GetPublicNSSKeySlotForResourceContext(
25 content::ResourceContext* context);
26
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.
31crypto::ScopedPK11Slot GetPrivateNSSKeySlotForResourceContext(
32 content::ResourceContext* context,
33 const base::Callback<void(crypto::ScopedPK11Slot)>& callback)
34 WARN_UNUSED_RESULT;
35
[email protected]057ad5f2013-12-20 19:00:5736// 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.
42net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
43 content::ResourceContext* context,
44 const base::Callback<void(net::NSSCertDatabase*)>& callback)
45 WARN_UNUSED_RESULT;
46
[email protected]557737f72013-12-06 22:24:0747#endif // CHROME_BROWSER_NET_NSS_CONTEXT_H_