| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_CONNECTION_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/browser/indexed_db/indexed_db_database.h" | 9 #include "content/browser/indexed_db/indexed_db_database.h" |
| 10 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 10 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class IndexedDBCallbacks; | 13 class IndexedDBCallbacks; |
| 14 class IndexedDBDatabaseError; | 14 class IndexedDBDatabaseError; |
| 15 | 15 |
| 16 class CONTENT_EXPORT IndexedDBConnection { | 16 class CONTENT_EXPORT IndexedDBConnection { |
| 17 public: | 17 public: |
| 18 IndexedDBConnection(scoped_refptr<IndexedDBDatabase> db, | 18 IndexedDBConnection(scoped_refptr<IndexedDBDatabase> db, |
| 19 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks); | 19 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks); |
| 20 virtual ~IndexedDBConnection(); | 20 virtual ~IndexedDBConnection(); |
| 21 | 21 |
| 22 // These methods are virtual to allow subclassing in unit tests. | 22 // These methods are virtual to allow subclassing in unit tests. |
| 23 virtual void ForceClose(); | 23 virtual void ForceClose(); |
| 24 virtual void Close(); | 24 virtual void Close(); |
| 25 virtual bool IsConnected(); | 25 virtual bool IsConnected(); |
| 26 | 26 |
| 27 void VersionChangeIgnored(); | 27 void VersionChangeIgnored(); |
| 28 | 28 |
| 29 IndexedDBDatabase* database() { return database_; } | 29 IndexedDBDatabase* database() { return database_.get(); } |
| 30 IndexedDBDatabaseCallbacks* callbacks() { return callbacks_; } | 30 IndexedDBDatabaseCallbacks* callbacks() { return callbacks_.get(); } |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // NULL in some unit tests, and after the connection is closed. | 33 // NULL in some unit tests, and after the connection is closed. |
| 34 scoped_refptr<IndexedDBDatabase> database_; | 34 scoped_refptr<IndexedDBDatabase> database_; |
| 35 | 35 |
| 36 // The callbacks_ member is cleared when the connection is closed. | 36 // The callbacks_ member is cleared when the connection is closed. |
| 37 // May be NULL in unit tests. | 37 // May be NULL in unit tests. |
| 38 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; | 38 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); | 40 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace content | 43 } // namespace content |
| 44 | 44 |
| 45 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 45 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
| OLD | NEW |