OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/process/process_handle.h" |
| 12 #include "content/browser/bad_message.h" |
| 13 #include "content/public/browser/browser_context.h" |
| 14 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 15 #include "third_party/WebKit/public/platform/modules/indexeddb/indexed_db.mojom.
h" |
| 16 |
| 17 namespace content { |
| 18 class IndexedDBConnection; |
| 19 class IndexedDBContextImpl; |
| 20 class IndexedDBDatabaseError; |
| 21 struct IndexedDBDatabaseMetadata; |
| 22 } |
| 23 |
| 24 namespace net { |
| 25 class URLRequestContext; |
| 26 class URLRequestContextGetter; |
| 27 } |
| 28 |
| 29 namespace indexed_db { |
| 30 |
| 31 class DatabaseFactoryImpl : public mojom::DatabaseFactory, |
| 32 public base::SupportsWeakPtr<DatabaseFactoryImpl> { |
| 33 public: |
| 34 static void Create(content::BrowserContext* context, |
| 35 net::URLRequestContextGetter* request_context_getter, |
| 36 mojom::DatabaseFactoryRequest request); |
| 37 |
| 38 private: |
| 39 DatabaseFactoryImpl(content::BrowserContext* context, |
| 40 content::IndexedDBContextImpl* indexed_db_context, |
| 41 net::URLRequestContext* request_context, |
| 42 mojom::DatabaseFactoryRequest request); |
| 43 ~DatabaseFactoryImpl() override; |
| 44 |
| 45 int64_t HostTransactionId(int64_t transaction_id); |
| 46 int64_t RendererTransactionId(int64_t host_transaction_id); |
| 47 |
| 48 void CrashRendererAndClosePipe(content::bad_message::BadMessageReason reason); |
| 49 |
| 50 content::RenderProcessHost* GetRenderProcessHost(); |
| 51 |
| 52 void OnOpenResult(const base::TimeTicks& begin_time, |
| 53 const OpenCallback& mojo_callback, |
| 54 std::unique_ptr<content::IndexedDBConnection> connection, |
| 55 const content::IndexedDBDatabaseMetadata& metadata, |
| 56 const content::IndexedDBDatabaseError& error); |
| 57 |
| 58 base::ProcessId peer_pid() const; |
| 59 |
| 60 // mojom::DatabaseFactory: |
| 61 void GetDatabaseNames(const url::Origin& origin) override; |
| 62 |
| 63 void Open(const mojo::String& name, |
| 64 int64_t version, |
| 65 int64_t transaction_id, |
| 66 const url::Origin& origin, |
| 67 mojom::OpenRequestObserverPtr open_observer, |
| 68 mojom::DatabaseObserverPtr database_handler, |
| 69 const OpenCallback& callback) override; |
| 70 |
| 71 void DeleteDatabase(const mojo::String& name, |
| 72 const url::Origin& origin) override; |
| 73 |
| 74 content::BrowserContext* context_; |
| 75 scoped_refptr<content::IndexedDBContextImpl> indexed_db_context_; |
| 76 net::URLRequestContext* request_context_; |
| 77 mojo::StrongBinding<mojom::DatabaseFactory> binding_; |
| 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(DatabaseFactoryImpl); |
| 80 }; |
| 81 |
| 82 } // namespace indexed_db |
| 83 |
| 84 #endif // CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_ |
OLD | NEW |