| 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 <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 19 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 20 #include "content/browser/indexed_db/indexed_db_database.h" | 20 #include "content/browser/indexed_db/indexed_db_database.h" |
| 21 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 21 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
| 22 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 #include "url/origin.h" |
| 24 | 25 |
| 25 namespace net { | 26 namespace net { |
| 26 class URLRequestContext; | 27 class URLRequestContext; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace content { | 30 namespace content { |
| 30 | 31 |
| 31 class IndexedDBBackingStore; | 32 class IndexedDBBackingStore; |
| 32 struct IndexedDBPendingConnection; | 33 struct IndexedDBPendingConnection; |
| 33 | 34 |
| 34 class CONTENT_EXPORT IndexedDBFactory | 35 class CONTENT_EXPORT IndexedDBFactory |
| 35 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) { | 36 : NON_EXPORTED_BASE(public base::RefCountedThreadSafe<IndexedDBFactory>) { |
| 36 public: | 37 public: |
| 37 typedef std::multimap<GURL, IndexedDBDatabase*> OriginDBMap; | 38 typedef std::multimap<GURL, IndexedDBDatabase*> OriginDBMap; |
| 38 typedef OriginDBMap::const_iterator OriginDBMapIterator; | 39 typedef OriginDBMap::const_iterator OriginDBMapIterator; |
| 39 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; | 40 typedef std::pair<OriginDBMapIterator, OriginDBMapIterator> OriginDBs; |
| 40 | 41 |
| 41 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, | 42 virtual void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, |
| 42 bool forced_close) = 0; | 43 bool forced_close) = 0; |
| 43 | 44 |
| 44 virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, | 45 virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, |
| 45 const GURL& origin_url, | 46 const url::Origin& origin, |
| 46 const base::FilePath& data_directory, | 47 const base::FilePath& data_directory, |
| 47 net::URLRequestContext* request_context) = 0; | 48 net::URLRequestContext* request_context) = 0; |
| 48 virtual void Open(const base::string16& name, | 49 virtual void Open(const base::string16& name, |
| 49 const IndexedDBPendingConnection& connection, | 50 const IndexedDBPendingConnection& connection, |
| 50 net::URLRequestContext* request_context, | 51 net::URLRequestContext* request_context, |
| 51 const GURL& origin_url, | 52 const url::Origin& origin, |
| 52 const base::FilePath& data_directory) = 0; | 53 const base::FilePath& data_directory) = 0; |
| 53 | 54 |
| 54 virtual void DeleteDatabase(const base::string16& name, | 55 virtual void DeleteDatabase(const base::string16& name, |
| 55 net::URLRequestContext* request_context, | 56 net::URLRequestContext* request_context, |
| 56 scoped_refptr<IndexedDBCallbacks> callbacks, | 57 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 57 const GURL& origin_url, | 58 const url::Origin& origin, |
| 58 const base::FilePath& data_directory) = 0; | 59 const base::FilePath& data_directory) = 0; |
| 59 | 60 |
| 60 virtual void HandleBackingStoreFailure(const GURL& origin_url) = 0; | 61 virtual void HandleBackingStoreFailure(const GURL& origin_url) = 0; |
| 61 virtual void HandleBackingStoreCorruption( | 62 virtual void HandleBackingStoreCorruption( |
| 62 const GURL& origin_url, | 63 const GURL& origin_url, |
| 63 const IndexedDBDatabaseError& error) = 0; | 64 const IndexedDBDatabaseError& error) = 0; |
| 64 | 65 |
| 65 virtual OriginDBs GetOpenDatabasesForOrigin(const GURL& origin_url) const = 0; | 66 virtual OriginDBs GetOpenDatabasesForOrigin(const GURL& origin_url) const = 0; |
| 66 | 67 |
| 67 virtual void ForceClose(const GURL& origin_url) = 0; | 68 virtual void ForceClose(const GURL& origin_url) = 0; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 bool first_time, | 105 bool first_time, |
| 105 leveldb::Status* status) = 0; | 106 leveldb::Status* status) = 0; |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory); | 109 DISALLOW_COPY_AND_ASSIGN(IndexedDBFactory); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 } // namespace content | 112 } // namespace content |
| 112 | 113 |
| 113 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ | 114 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ |
| OLD | NEW |