Index: content/browser/indexed_db/database_factory_impl.h |
diff --git a/content/browser/indexed_db/database_factory_impl.h b/content/browser/indexed_db/database_factory_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..11c017b35b2d2dfb71fa38119631e01f7610fb8c |
--- /dev/null |
+++ b/content/browser/indexed_db/database_factory_impl.h |
@@ -0,0 +1,92 @@ |
+// Copyright 2016 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 CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_ |
+#define CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_ |
+ |
+#include <memory> |
+#include <set> |
+#include <string> |
+ |
+#include "Source/modules/indexeddb/indexed_db.mojom.h" |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/process/process_handle.h" |
+#include "content/browser/bad_message.h" |
+#include "content/public/browser/browser_context.h" |
+#include "mojo/public/cpp/bindings/binding_set.h" |
+ |
+namespace net { |
+class URLRequestContextGetter; |
+} |
+ |
+namespace shell { |
+class InterfaceRegistry; |
+} |
+ |
+namespace content { |
+ |
+class IndexedDBConnection; |
+class IndexedDBContextImpl; |
+class IndexedDBDatabaseError; |
+struct IndexedDBDatabaseMetadata; |
+ |
+class DatabaseFactoryImpl : public ::indexed_db::mojom::DatabaseFactory, |
+ public base::SupportsWeakPtr<DatabaseFactoryImpl> { |
+ public: |
+ // TODO(cmumford): Keep Create()? |
+ static std::unique_ptr<DatabaseFactoryImpl> Create( |
+ IndexedDBContextImpl* indexed_db_context, |
+ net::URLRequestContextGetter* url_request_context_getter, |
+ int render_process_host_id); |
+ DatabaseFactoryImpl(IndexedDBContextImpl* indexed_db_context, |
+ net::URLRequestContextGetter* url_request_context_getter, |
+ int render_process_host_id); |
+ ~DatabaseFactoryImpl() override; |
+ |
+ void AddMojoService(shell::InterfaceRegistry* registry); |
+ void Bind(::indexed_db::mojom::DatabaseFactoryRequest request); |
+ |
+ private: |
+ void CrashRendererAndClosePipe(bad_message::BadMessageReason reason); |
+ |
+ RenderProcessHost* GetRenderProcessHost(); |
+ |
+ void OnOpenResult(const base::TimeTicks& begin_time, |
+ const OpenCallback& mojo_callback, |
+ std::unique_ptr<IndexedDBConnection> connection, |
+ const IndexedDBDatabaseMetadata& metadata, |
+ const IndexedDBDatabaseError& error); |
+ |
+ // indexed_db::mojom::DatabaseFactory: |
+ void GetDatabaseNames(const url::Origin& origin) override; |
+ |
+ void Open(const std::string& name, |
+ int64_t version, |
+ int64_t transaction_id, |
+ const url::Origin& origin, |
+ ::indexed_db::mojom::OpenRequestObserverPtr open_observer, |
+ ::indexed_db::mojom::DatabaseObserverPtr database_handler, |
+ const OpenCallback& callback) override; |
+ |
+ void DeleteDatabase(const std::string& name, |
+ const url::Origin& origin) override; |
+ |
+ void AddMojoServiceOnIDBThread(shell::InterfaceRegistry* registry); |
+ |
+ // Used to set file permissions for blob storage. |
+ int render_process_host_id_; |
+ scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
+ // Determine or document lifetime of getter. |
+ net::URLRequestContextGetter* request_context_getter_; |
+ std::set<std::unique_ptr<IndexedDBConnection>> connections_; |
+ mojo::BindingSet<::indexed_db::mojom::DatabaseFactory> binding_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DatabaseFactoryImpl); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_ |