Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / net / nss_context.h
blob53eab54cc7dc3980395d1d1aa374ba4858c5696a
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_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "crypto/scoped_nss_types.h"
14 namespace net {
15 class NSSCertDatabase;
18 namespace content {
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)
34 WARN_UNUSED_RESULT;
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)
45 WARN_UNUSED_RESULT;
47 #endif // CHROME_BROWSER_NET_NSS_CONTEXT_H_