Index: components/cert_database/public/cert_database_service_io_part.h |
diff --git a/components/cert_database/public/cert_database_service_io_part.h b/components/cert_database/public/cert_database_service_io_part.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..78e9471df92f0c346988da640a5ee85d7fa7af42 |
--- /dev/null |
+++ b/components/cert_database/public/cert_database_service_io_part.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_CERT_DATABASE_PUBLIC_CERT_DATABASE_SERVICE_IO_PART_H_ |
+#define COMPONENTS_CERT_DATABASE_PUBLIC_CERT_DATABASE_SERVICE_IO_PART_H_ |
+ |
+#include <vector> |
+ |
+#include "base/callback_forward.h" |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/threading/thread_checker.h" |
+ |
+namespace net { |
+class NSSCertDatabase; |
+} |
+ |
+namespace cert_database { |
+ |
+// Any object of this class is constructed on the UI thread. Afterwards it may |
+// only be accessed on IO thread. |
+class CertDatabaseServiceIOPart { |
+ public: |
+ typedef base::Callback<void(net::NSSCertDatabase*)> GetCertDBCallback; |
+ |
+ CertDatabaseServiceIOPart(); |
+ virtual ~CertDatabaseServiceIOPart(); |
+ |
+ virtual void Init(); |
+ |
+ WARN_UNUSED_RESULT net::NSSCertDatabase* GetNSSCertDatabase( |
+ const GetCertDBCallback& callback); |
+ |
+ base::WeakPtr<CertDatabaseServiceIOPart> GetWeakPtr(); |
+ |
+ protected: |
+ virtual void DidCreateNSSCertDatabase(scoped_ptr<net::NSSCertDatabase> db); |
+ |
+ base::ThreadChecker thread_checker_; |
+ |
+ private: |
+ typedef std::vector<GetCertDBCallback> GetCertDBCallbacks; |
+ |
+ scoped_ptr<net::NSSCertDatabase> nss_cert_database_; |
+ GetCertDBCallbacks get_cert_db_callbacks_; |
+ |
+ base::WeakPtrFactory<CertDatabaseServiceIOPart> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CertDatabaseServiceIOPart); |
+}; |
+ |
+} // namespace cert_database |
+ |
+#endif // COMPONENTS_CERT_DATABASE_PUBLIC_CERT_DATABASE_SERVICE_IO_PART_H_ |