[email protected] | 557737f7 | 2013-12-06 22:24:07 | [diff] [blame] | 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 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] | 057ad5f | 2013-12-20 19:00:57 | [diff] [blame^] | 14 | namespace net { |
| 15 | class NSSCertDatabase; |
| 16 | } |
| 17 | |
[email protected] | 557737f7 | 2013-12-06 22:24:07 | [diff] [blame] | 18 | namespace content { |
| 19 | class 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. |
| 24 | crypto::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. |
| 31 | crypto::ScopedPK11Slot GetPrivateNSSKeySlotForResourceContext( |
| 32 | content::ResourceContext* context, |
| 33 | const base::Callback<void(crypto::ScopedPK11Slot)>& callback) |
| 34 | WARN_UNUSED_RESULT; |
| 35 | |
[email protected] | 057ad5f | 2013-12-20 19:00:57 | [diff] [blame^] | 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; |
| 46 | |
[email protected] | 557737f7 | 2013-12-06 22:24:07 | [diff] [blame] | 47 | #endif // CHROME_BROWSER_NET_NSS_CONTEXT_H_ |