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/compiler_specific.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/thread_checker.h" |
| 15 |
| 16 namespace net { |
| 17 class NSSCertDatabase; |
| 18 } |
| 19 |
| 20 // Any object of this class is constructed on the UI thread. Afterwards it may |
| 21 // only be accessed on IO thread. |
| 22 class CertDatabaseServiceIOPart { |
| 23 public: |
| 24 typedef base::Callback<void(net::NSSCertDatabase*)> GetCertDBCallback; |
| 25 |
| 26 CertDatabaseServiceIOPart(); |
| 27 virtual ~CertDatabaseServiceIOPart(); |
| 28 |
| 29 virtual void Init(); |
| 30 |
| 31 WARN_UNUSED_RESULT net::NSSCertDatabase* GetNSSCertDatabase( |
| 32 const GetCertDBCallback& callback); |
| 33 |
| 34 base::WeakPtr<CertDatabaseServiceIOPart> GetWeakPtr(); |
| 35 |
| 36 protected: |
| 37 virtual void DidCreateNSSCertDatabase(scoped_ptr<net::NSSCertDatabase> db); |
| 38 |
| 39 base::ThreadChecker thread_checker_; |
| 40 |
| 41 private: |
| 42 typedef std::vector<GetCertDBCallback> GetCertDBCallbacks; |
| 43 |
| 44 scoped_ptr<net::NSSCertDatabase> nss_cert_database_; |
| 45 GetCertDBCallbacks get_cert_db_callbacks_; |
| 46 |
| 47 base::WeakPtrFactory<CertDatabaseServiceIOPart> weak_ptr_factory_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(CertDatabaseServiceIOPart); |
| 50 }; |
| 51 |
| 52 #endif // COMPONENTS_CERT_DATABASE_PUBLIC_CERT_DATABASE_SERVICE_IO_PART_H_ |
OLD | NEW |