OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" | |
6 | |
7 #include "base/memory/scoped_vector.h" | |
8 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | |
9 #include "content/common/indexed_db/indexed_db_messages.h" | |
10 #include "third_party/WebKit/public/platform/WebIDBDatabaseError.h" | |
11 | |
12 namespace content { | |
13 | |
14 IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks( | |
15 IndexedDBDispatcherHost* dispatcher_host, | |
16 int ipc_thread_id, | |
17 int ipc_database_callbacks_id) | |
18 : dispatcher_host_(dispatcher_host), | |
19 ipc_thread_id_(ipc_thread_id), | |
20 ipc_database_callbacks_id_(ipc_database_callbacks_id) {} | |
21 | |
22 IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() {} | |
23 | |
24 void IndexedDBDatabaseCallbacks::onForcedClose() { | |
25 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksForcedClose( | |
26 ipc_thread_id_, ipc_database_callbacks_id_)); | |
27 } | |
28 | |
29 void IndexedDBDatabaseCallbacks::onVersionChange(long long old_version, | |
30 long long new_version) { | |
31 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksIntVersionChange( | |
32 ipc_thread_id_, ipc_database_callbacks_id_, old_version, new_version)); | |
33 } | |
34 | |
35 void IndexedDBDatabaseCallbacks::onAbort( | |
36 long long host_transaction_id, | |
37 const WebKit::WebIDBDatabaseError& error) { | |
38 dispatcher_host_->FinishTransaction(host_transaction_id, false); | |
39 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksAbort( | |
40 ipc_thread_id_, | |
41 ipc_database_callbacks_id_, | |
42 dispatcher_host_->RendererTransactionId(host_transaction_id), | |
43 error.code(), | |
44 error.message())); | |
45 } | |
46 | |
47 void IndexedDBDatabaseCallbacks::onComplete(long long host_transaction_id) { | |
48 dispatcher_host_->FinishTransaction(host_transaction_id, true); | |
49 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksComplete( | |
50 ipc_thread_id_, | |
51 ipc_database_callbacks_id_, | |
52 dispatcher_host_->RendererTransactionId(host_transaction_id))); | |
53 } | |
54 | |
55 } // namespace content | |
OLD | NEW |