OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 COMPONENTS_CERT_DATABASE_PUBLIC_CERT_DATABASE_SERVICE_IO_PART_H_ | |
6 #define COMPONENTS_CERT_DATABASE_PUBLIC_CERT_DATABASE_SERVICE_IO_PART_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/callback_forward.h" | |
11 #include "base/macros.h" | |
12 #include "base/memory/weak_ptr.h" | |
13 #include "base/threading/thread_checker.h" | |
14 | |
15 namespace net { | |
16 class NSSCertDatabase; | |
17 } | |
18 | |
19 namespace cert_database { | |
20 | |
21 // Any object of this class is constructed on the UI thread. Afterwards it may | |
22 // only be accessed on IO thread. | |
23 class CertDatabaseServiceIOPart { | |
24 public: | |
25 typedef base::Callback<void(net::NSSCertDatabase*)> GetCertDBCallback; | |
26 | |
27 CertDatabaseServiceIOPart(); | |
28 virtual ~CertDatabaseServiceIOPart(); | |
29 | |
30 virtual void Init(); | |
31 | |
32 WARN_UNUSED_RESULT net::NSSCertDatabase* GetNSSCertDatabase( | |
33 const GetCertDBCallback& callback); | |
34 | |
35 base::WeakPtr<CertDatabaseServiceIOPart> GetWeakPtr(); | |
36 | |
37 protected: | |
38 virtual void DidCreateNSSCertDatabase(scoped_ptr<net::NSSCertDatabase> db); | |
tbarzic
2014/10/22 20:38:19
I don't think this really has to be virtual, you c
pneubeck (no reviews)
2014/10/24 12:51:37
Yes, that's better.
| |
39 | |
40 base::ThreadChecker thread_checker_; | |
41 | |
42 private: | |
43 typedef std::vector<GetCertDBCallback> GetCertDBCallbacks; | |
44 | |
45 scoped_ptr<net::NSSCertDatabase> nss_cert_database_; | |
46 GetCertDBCallbacks get_cert_db_callbacks_; | |
47 | |
48 base::WeakPtrFactory<CertDatabaseServiceIOPart> weak_ptr_factory_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(CertDatabaseServiceIOPart); | |
51 }; | |
52 | |
53 } // namespace cert_database | |
54 | |
55 #endif // COMPONENTS_CERT_DATABASE_PUBLIC_CERT_DATABASE_SERVICE_IO_PART_H_ | |
OLD | NEW |