OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
20 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 20 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
21 #include "content/browser/indexed_db/indexed_db_database.h" | 21 #include "content/browser/indexed_db/indexed_db_database.h" |
22 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 22 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
25 #include "url/origin.h" | 25 #include "url/origin.h" |
26 | 26 |
27 namespace net { | 27 namespace net { |
28 class URLRequestContext; | 28 class URLRequestContextGetter; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 | 32 |
33 class IndexedDBBackingStore; | 33 class IndexedDBBackingStore; |
34 struct IndexedDBPendingConnection; | 34 struct IndexedDBPendingConnection; |
35 struct IndexedDBDataLossInfo; | 35 struct IndexedDBDataLossInfo; |
36 | 36 |
37 class CONTENT_EXPORT IndexedDBFactory | 37 class CONTENT_EXPORT IndexedDBFactory |
38 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) { | 38 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) { |
39 public: | 39 public: |
40 typedef std::multimap<url::Origin, IndexedDBDatabase*> OriginDBMap; | 40 typedef std::multimap<url::Origin, IndexedDBDatabase*> OriginDBMap; |
41 typedef OriginDBMap::const_iterator OriginDBMapIterator; | 41 typedef OriginDBMap::const_iterator OriginDBMapIterator; |
42 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; | 42 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; |
43 | 43 |
44 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, | 44 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, |
45 bool forced_close) = 0; | 45 bool forced_close) = 0; |
46 | 46 |
47 virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, | 47 virtual void GetDatabaseNames( |
48 const url::Origin& origin, | 48 scoped_refptr<IndexedDBCallbacks> callbacks, |
49 const base::FilePath& data_directory, | 49 const url::Origin& origin, |
50 net::URLRequestContext* request_context) = 0; | 50 const base::FilePath& data_directory, |
51 virtual void Open(const base::string16& name, | 51 scoped_refptr<net::URLRequestContextGetter> request_context_getter) = 0; |
52 std::unique_ptr<IndexedDBPendingConnection> connection, | 52 virtual void Open( |
53 net::URLRequestContext* request_context, | 53 const base::string16& name, |
54 const url::Origin& origin, | 54 std::unique_ptr<IndexedDBPendingConnection> connection, |
55 const base::FilePath& data_directory) = 0; | 55 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 56 const url::Origin& origin, |
| 57 const base::FilePath& data_directory) = 0; |
56 | 58 |
57 virtual void DeleteDatabase(const base::string16& name, | 59 virtual void DeleteDatabase( |
58 net::URLRequestContext* request_context, | 60 const base::string16& name, |
59 scoped_refptr<IndexedDBCallbacks> callbacks, | 61 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
60 const url::Origin& origin, | 62 scoped_refptr<IndexedDBCallbacks> callbacks, |
61 const base::FilePath& data_directory) = 0; | 63 const url::Origin& origin, |
| 64 const base::FilePath& data_directory) = 0; |
62 | 65 |
63 virtual void HandleBackingStoreFailure(const url::Origin& origin) = 0; | 66 virtual void HandleBackingStoreFailure(const url::Origin& origin) = 0; |
64 virtual void HandleBackingStoreCorruption( | 67 virtual void HandleBackingStoreCorruption( |
65 const url::Origin& origin, | 68 const url::Origin& origin, |
66 const IndexedDBDatabaseError& error) = 0; | 69 const IndexedDBDatabaseError& error) = 0; |
67 | 70 |
68 virtual OriginDBs GetOpenDatabasesForOrigin( | 71 virtual OriginDBs GetOpenDatabasesForOrigin( |
69 const url::Origin& origin) const = 0; | 72 const url::Origin& origin) const = 0; |
70 | 73 |
71 virtual void ForceClose(const url::Origin& origin) = 0; | 74 virtual void ForceClose(const url::Origin& origin) = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
85 | 88 |
86 protected: | 89 protected: |
87 friend class base::RefCountedThreadSafe<IndexedDBFactory>; | 90 friend class base::RefCountedThreadSafe<IndexedDBFactory>; |
88 | 91 |
89 IndexedDBFactory() {} | 92 IndexedDBFactory() {} |
90 virtual ~IndexedDBFactory() {} | 93 virtual ~IndexedDBFactory() {} |
91 | 94 |
92 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( | 95 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( |
93 const url::Origin& origin, | 96 const url::Origin& origin, |
94 const base::FilePath& data_directory, | 97 const base::FilePath& data_directory, |
95 net::URLRequestContext* request_context, | 98 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
96 IndexedDBDataLossInfo* data_loss_info, | 99 IndexedDBDataLossInfo* data_loss_info, |
97 bool* disk_full, | 100 bool* disk_full, |
98 leveldb::Status* status) = 0; | 101 leveldb::Status* status) = 0; |
99 | 102 |
100 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper( | 103 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStoreHelper( |
101 const url::Origin& origin, | 104 const url::Origin& origin, |
102 const base::FilePath& data_directory, | 105 const base::FilePath& data_directory, |
103 net::URLRequestContext* request_context, | 106 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
104 IndexedDBDataLossInfo* data_loss_info, | 107 IndexedDBDataLossInfo* data_loss_info, |
105 bool* disk_full, | 108 bool* disk_full, |
106 bool first_time, | 109 bool first_time, |
107 leveldb::Status* status) = 0; | 110 leveldb::Status* status) = 0; |
108 | 111 |
109 private: | 112 private: |
110 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory); | 113 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory); |
111 }; | 114 }; |
112 | 115 |
113 } // namespace content | 116 } // namespace content |
114 | 117 |
115 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ | 118 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ |
OLD | NEW |