| 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 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 idb_store_metadata.indexes.push_back(idb_index_metadata); | 216 idb_store_metadata.indexes.push_back(idb_index_metadata); |
| 217 } | 217 } |
| 218 metadata.object_stores.push_back(idb_store_metadata); | 218 metadata.object_stores.push_back(idb_store_metadata); |
| 219 } | 219 } |
| 220 return metadata; | 220 return metadata; |
| 221 } | 221 } |
| 222 | 222 |
| 223 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( | 223 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( |
| 224 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { | 224 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { |
| 225 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 225 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 226 FilePath indexed_db_path = indexed_db_context_->data_path(); | 226 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 227 | 227 |
| 228 WebSecurityOrigin origin( | 228 WebSecurityOrigin origin( |
| 229 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | 229 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); |
| 230 | 230 |
| 231 Context()->GetIDBFactory()->getDatabaseNames( | 231 Context()->GetIDBFactory()->getDatabaseNames( |
| 232 new IndexedDBCallbacks<WebDOMStringList>(this, params.ipc_thread_id, | 232 new IndexedDBCallbacks<WebDOMStringList>(this, params.ipc_thread_id, |
| 233 params.ipc_response_id), origin, NULL, | 233 params.ipc_response_id), origin, NULL, |
| 234 webkit_base::FilePathToWebString(indexed_db_path)); | 234 webkit_base::FilePathToWebString(indexed_db_path)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void IndexedDBDispatcherHost::OnIDBFactoryOpen( | 237 void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
| 238 const IndexedDBHostMsg_FactoryOpen_Params& params) { | 238 const IndexedDBHostMsg_FactoryOpen_Params& params) { |
| 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 240 FilePath indexed_db_path = indexed_db_context_->data_path(); | 240 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 241 | 241 |
| 242 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); | 242 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); |
| 243 WebSecurityOrigin origin( | 243 WebSecurityOrigin origin( |
| 244 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | 244 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); |
| 245 | 245 |
| 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 247 | 247 |
| 248 int64 host_transaction_id = HostTransactionId(params.transaction_id); | 248 int64 host_transaction_id = HostTransactionId(params.transaction_id); |
| 249 | 249 |
| 250 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 250 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
| 251 // created) if this origin is already over quota. | 251 // created) if this origin is already over quota. |
| 252 Context()->GetIDBFactory()->open( | 252 Context()->GetIDBFactory()->open( |
| 253 params.name, | 253 params.name, |
| 254 params.version, | 254 params.version, |
| 255 host_transaction_id, | 255 host_transaction_id, |
| 256 new IndexedDBCallbacksDatabase(this, params.ipc_thread_id, | 256 new IndexedDBCallbacksDatabase(this, params.ipc_thread_id, |
| 257 params.ipc_response_id, | 257 params.ipc_response_id, |
| 258 host_transaction_id, | 258 host_transaction_id, |
| 259 origin_url), | 259 origin_url), |
| 260 new IndexedDBDatabaseCallbacks(this, params.ipc_thread_id, | 260 new IndexedDBDatabaseCallbacks(this, params.ipc_thread_id, |
| 261 params.ipc_database_response_id), | 261 params.ipc_database_response_id), |
| 262 origin, NULL, webkit_base::FilePathToWebString(indexed_db_path)); | 262 origin, NULL, webkit_base::FilePathToWebString(indexed_db_path)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 265 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
| 266 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 266 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
| 267 FilePath indexed_db_path = indexed_db_context_->data_path(); | 267 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 268 | 268 |
| 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 270 Context()->GetIDBFactory()->deleteDatabase( | 270 Context()->GetIDBFactory()->deleteDatabase( |
| 271 params.name, | 271 params.name, |
| 272 new IndexedDBCallbacks<WebSerializedScriptValue>(this, | 272 new IndexedDBCallbacks<WebSerializedScriptValue>(this, |
| 273 params.ipc_thread_id, | 273 params.ipc_thread_id, |
| 274 params.ipc_response_id), | 274 params.ipc_response_id), |
| 275 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, | 275 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, |
| 276 webkit_base::FilePathToWebString(indexed_db_path)); | 276 webkit_base::FilePathToWebString(indexed_db_path)); |
| 277 } | 277 } |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 ipc_response_id), ec); | 788 ipc_response_id), ec); |
| 789 DCHECK(!ec); | 789 DCHECK(!ec); |
| 790 } | 790 } |
| 791 | 791 |
| 792 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 792 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
| 793 int32 ipc_object_id) { | 793 int32 ipc_object_id) { |
| 794 parent_->DestroyObject(&map_, ipc_object_id); | 794 parent_->DestroyObject(&map_, ipc_object_id); |
| 795 } | 795 } |
| 796 | 796 |
| 797 } // namespace content | 797 } // namespace content |
| OLD | NEW |