| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 metadata.object_stores.push_back(idb_store_metadata); | 222 metadata.object_stores.push_back(idb_store_metadata); |
| 223 } | 223 } |
| 224 return metadata; | 224 return metadata; |
| 225 } | 225 } |
| 226 | 226 |
| 227 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( | 227 void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames( |
| 228 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { | 228 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) { |
| 229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 229 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 230 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 230 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 231 | 231 |
| 232 WebSecurityOrigin origin( | |
| 233 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | |
| 234 | |
| 235 Context()->GetIDBFactory()->getDatabaseNames( | 232 Context()->GetIDBFactory()->getDatabaseNames( |
| 236 new IndexedDBCallbacks<WebVector<WebString> >(this, params.ipc_thread_id, | 233 new IndexedDBCallbacks<WebVector<WebString> >(this, params.ipc_thread_id, |
| 237 params.ipc_callbacks_id), origin, NULL, | 234 params.ipc_callbacks_id), params.database_identifier, |
| 238 webkit_base::FilePathToWebString(indexed_db_path)); | 235 webkit_base::FilePathToWebString(indexed_db_path)); |
| 239 } | 236 } |
| 240 | 237 |
| 241 void IndexedDBDispatcherHost::OnIDBFactoryOpen( | 238 void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
| 242 const IndexedDBHostMsg_FactoryOpen_Params& params) { | 239 const IndexedDBHostMsg_FactoryOpen_Params& params) { |
| 243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 244 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 241 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 245 | 242 |
| 246 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); | 243 GURL origin_url = |
| 247 WebSecurityOrigin origin( | 244 DatabaseUtil::GetOriginFromIdentifier(params.database_identifier); |
| 248 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | |
| 249 | 245 |
| 250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 251 | 247 |
| 252 int64 host_transaction_id = HostTransactionId(params.transaction_id); | 248 int64 host_transaction_id = HostTransactionId(params.transaction_id); |
| 253 | 249 |
| 254 // 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 |
| 255 // created) if this origin is already over quota. | 251 // created) if this origin is already over quota. |
| 256 Context()->GetIDBFactory()->open( | 252 Context()->GetIDBFactory()->open( |
| 257 params.name, | 253 params.name, |
| 258 params.version, | 254 params.version, |
| 259 host_transaction_id, | 255 host_transaction_id, |
| 260 new IndexedDBCallbacksDatabase(this, params.ipc_thread_id, | 256 new IndexedDBCallbacksDatabase(this, params.ipc_thread_id, |
| 261 params.ipc_callbacks_id, | 257 params.ipc_callbacks_id, |
| 262 params.ipc_database_callbacks_id, | 258 params.ipc_database_callbacks_id, |
| 263 host_transaction_id, | 259 host_transaction_id, |
| 264 origin_url), | 260 origin_url), |
| 265 new IndexedDBDatabaseCallbacks(this, params.ipc_thread_id, | 261 new IndexedDBDatabaseCallbacks(this, params.ipc_thread_id, |
| 266 params.ipc_database_callbacks_id), | 262 params.ipc_database_callbacks_id), |
| 267 origin, NULL, webkit_base::FilePathToWebString(indexed_db_path)); | 263 params.database_identifier, |
| 264 webkit_base::FilePathToWebString(indexed_db_path)); |
| 268 } | 265 } |
| 269 | 266 |
| 270 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 267 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
| 271 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 268 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
| 272 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 269 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 273 | 270 |
| 274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
| 275 Context()->GetIDBFactory()->deleteDatabase( | 272 Context()->GetIDBFactory()->deleteDatabase( |
| 276 params.name, | 273 params.name, |
| 277 new IndexedDBCallbacks<WebData>(this, | 274 new IndexedDBCallbacks<WebData>(this, |
| 278 params.ipc_thread_id, | 275 params.ipc_thread_id, |
| 279 params.ipc_callbacks_id), | 276 params.ipc_callbacks_id), |
| 280 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin), NULL, | 277 params.database_identifier, |
| 281 webkit_base::FilePathToWebString(indexed_db_path)); | 278 webkit_base::FilePathToWebString(indexed_db_path)); |
| 282 } | 279 } |
| 283 | 280 |
| 284 void IndexedDBDispatcherHost::FinishTransaction( | 281 void IndexedDBDispatcherHost::FinishTransaction( |
| 285 int64 host_transaction_id, bool committed) { | 282 int64 host_transaction_id, bool committed) { |
| 286 TransactionIDToURLMap& transaction_url_map = | 283 TransactionIDToURLMap& transaction_url_map = |
| 287 database_dispatcher_host_->transaction_url_map_; | 284 database_dispatcher_host_->transaction_url_map_; |
| 288 TransactionIDToSizeMap& transaction_size_map = | 285 TransactionIDToSizeMap& transaction_size_map = |
| 289 database_dispatcher_host_->transaction_size_map_; | 286 database_dispatcher_host_->transaction_size_map_; |
| 290 TransactionIDToDatabaseIDMap& transaction_database_map = | 287 TransactionIDToDatabaseIDMap& transaction_database_map = |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 new IndexedDBCallbacks<WebData>(parent_, ipc_thread_id, | 832 new IndexedDBCallbacks<WebData>(parent_, ipc_thread_id, |
| 836 ipc_callbacks_id)); | 833 ipc_callbacks_id)); |
| 837 } | 834 } |
| 838 | 835 |
| 839 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 836 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
| 840 int32 ipc_object_id) { | 837 int32 ipc_object_id) { |
| 841 parent_->DestroyObject(&map_, ipc_object_id); | 838 parent_->DestroyObject(&map_, ipc_object_id); |
| 842 } | 839 } |
| 843 | 840 |
| 844 } // namespace content | 841 } // namespace content |
| OLD | NEW |