OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NET_NSS_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_NET_NSS_CONTEXT_H_ |
6 #define CHROME_BROWSER_NET_NSS_CONTEXT_H_ | 6 #define CHROME_BROWSER_NET_NSS_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "crypto/scoped_nss_types.h" | 12 #include "crypto/scoped_nss_types.h" |
13 | 13 |
| 14 class Profile; |
| 15 |
14 namespace net { | 16 namespace net { |
15 class NSSCertDatabase; | 17 class NSSCertDatabase; |
16 } | 18 } |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 class ResourceContext; | 21 class ResourceContext; |
20 } // namespace content | 22 } // namespace content |
21 | 23 |
22 // Returns a reference to the public slot for the user associated with | 24 // Returns a reference to the public slot for the user associated with |
23 // |context|. Should be called only on the IO thread. | 25 // |context|. Should be called only on the IO thread. |
(...skipping 13 matching lines...) Expand all Loading... |
37 // |context|, if it is ready. If it is not ready and |callback| is non-null, the | 39 // |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 | 40 // |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 | 41 // transferred, but the caller may save the pointer, which will remain valid for |
40 // the lifetime of the ResourceContext. | 42 // the lifetime of the ResourceContext. |
41 // Should be called only on the IO thread. | 43 // Should be called only on the IO thread. |
42 net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext( | 44 net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext( |
43 content::ResourceContext* context, | 45 content::ResourceContext* context, |
44 const base::Callback<void(net::NSSCertDatabase*)>& callback) | 46 const base::Callback<void(net::NSSCertDatabase*)>& callback) |
45 WARN_UNUSED_RESULT; | 47 WARN_UNUSED_RESULT; |
46 | 48 |
| 49 // Gets a pointer to the NSSCertDatabase for the user associated with |context|. |
| 50 // It's a wrapper around |GetNSSCertDatabaseForResourceContext| which makes |
| 51 // sure it's called on IO thread (with |profile|'s resource context). The |
| 52 // callback will be called on the originating message loop. |
| 53 // It's accessing profile, so it should be called on the UI thread. |
| 54 void GetNSSCertDatabaseForProfile( |
| 55 Profile* profile, |
| 56 const base::Callback<void(net::NSSCertDatabase*)>& callback); |
| 57 |
47 #endif // CHROME_BROWSER_NET_NSS_CONTEXT_H_ | 58 #endif // CHROME_BROWSER_NET_NSS_CONTEXT_H_ |
OLD | NEW |