OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DATABASE_CALLBACKS_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_ |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" |
9 | 11 |
10 namespace content { | 12 namespace content { |
11 class IndexedDBDatabaseError; | 13 class IndexedDBDatabaseError; |
12 class IndexedDBDispatcherHost; | 14 class IndexedDBDispatcherHost; |
13 | 15 |
14 class IndexedDBDatabaseCallbacks { | 16 class CONTENT_EXPORT IndexedDBDatabaseCallbacks |
| 17 : public base::RefCounted<IndexedDBDatabaseCallbacks> { |
15 public: | 18 public: |
16 IndexedDBDatabaseCallbacks(IndexedDBDispatcherHost* dispatcher_host, | 19 static scoped_refptr<IndexedDBDatabaseCallbacks> Create( |
17 int ipc_thread_id, | 20 IndexedDBDispatcherHost* dispatcher_host, |
18 int ipc_database_callbacks_id); | 21 int ipc_thread_id, |
| 22 int ipc_database_callbacks_id) { |
| 23 return make_scoped_refptr( |
| 24 new IndexedDBDatabaseCallbacks( |
| 25 dispatcher_host, ipc_thread_id, ipc_database_callbacks_id)); |
| 26 } |
19 | 27 |
| 28 virtual void OnForcedClose(); |
| 29 virtual void OnVersionChange(int64 old_version, int64 new_version); |
| 30 |
| 31 virtual void OnAbort(int64 host_transaction_id, |
| 32 const IndexedDBDatabaseError& error); |
| 33 virtual void OnComplete(int64 host_transaction_id); |
| 34 |
| 35 protected: |
| 36 IndexedDBDatabaseCallbacks( |
| 37 IndexedDBDispatcherHost* dispatcher_host, |
| 38 int ipc_thread_id, |
| 39 int ipc_database_callbacks_id); |
20 virtual ~IndexedDBDatabaseCallbacks(); | 40 virtual ~IndexedDBDatabaseCallbacks(); |
21 | 41 |
22 virtual void onForcedClose(); | 42 private: |
23 virtual void onVersionChange(long long old_version, long long new_version); | 43 friend class base::RefCounted<IndexedDBDatabaseCallbacks>; |
24 virtual void onAbort(long long host_transaction_id, | |
25 const IndexedDBDatabaseError& error); | |
26 virtual void onComplete(long long host_transaction_id); | |
27 | 44 |
28 private: | |
29 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; | 45 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
30 int ipc_thread_id_; | 46 int ipc_thread_id_; |
31 int ipc_database_callbacks_id_; | 47 int ipc_database_callbacks_id_; |
32 }; | 48 }; |
33 | 49 |
34 } // namespace content | 50 } // namespace content |
35 | 51 |
36 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_ | 52 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_CALLBACKS_H_ |
OLD | NEW |