| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if (m_type == DOMFileSystemBase::persistentPathPrefix) | 154 if (m_type == DOMFileSystemBase::persistentPathPrefix) |
| 155 type = FileSystemTypePersistent; | 155 type = FileSystemTypePersistent; |
| 156 else if (m_type == DOMFileSystemBase::temporaryPathPrefix) | 156 else if (m_type == DOMFileSystemBase::temporaryPathPrefix) |
| 157 type = FileSystemTypeTemporary; | 157 type = FileSystemTypeTemporary; |
| 158 else { | 158 else { |
| 159 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 159 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 160 return; | 160 return; |
| 161 } | 161 } |
| 162 | 162 |
| 163 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &FileSystemRootRequest::didGetEntry); | 163 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &FileSystemRootRequest::didGetEntry); |
| 164 OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::creat
e(successCallback, errorCallback, scriptExecutionContext, type, "/"); | 164 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, scriptExecutionContext, type, "/"); |
| 165 | 165 |
| 166 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); | 166 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 bool FileSystemRootRequest::didGetEntry(Entry* entry) | 169 bool FileSystemRootRequest::didGetEntry(Entry* entry) |
| 170 { | 170 { |
| 171 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent
ry::create() | 171 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent
ry::create() |
| 172 .setUrl(entry->toURL()) | 172 .setUrl(entry->toURL()) |
| 173 .setName("/") | 173 .setName("/") |
| 174 .setIsDirectory(true); | 174 .setIsDirectory(true); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DirectoryContentRequest::didHitError); | 225 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DirectoryContentRequest::didHitError); |
| 226 FileSystemType type; | 226 FileSystemType type; |
| 227 String path; | 227 String path; |
| 228 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { | 228 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { |
| 229 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 229 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 230 return; | 230 return; |
| 231 } | 231 } |
| 232 | 232 |
| 233 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &DirectoryContentRequest::didGetEntry); | 233 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &DirectoryContentRequest::didGetEntry); |
| 234 OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::creat
e(successCallback, errorCallback, scriptExecutionContext, type, path); | 234 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, scriptExecutionContext, type, path); |
| 235 | 235 |
| 236 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); | 236 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 bool DirectoryContentRequest::didGetEntry(Entry* entry) | 239 bool DirectoryContentRequest::didGetEntry(Entry* entry) |
| 240 { | 240 { |
| 241 if (!entry->isDirectory()) { | 241 if (!entry->isDirectory()) { |
| 242 reportResult(FileError::TYPE_MISMATCH_ERR); | 242 reportResult(FileError::TYPE_MISMATCH_ERR); |
| 243 return true; | 243 return true; |
| 244 } | 244 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &MetadataRequest::didHitError); | 350 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &MetadataRequest::didHitError); |
| 351 | 351 |
| 352 FileSystemType type; | 352 FileSystemType type; |
| 353 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, m_path)) { | 353 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, m_path)) { |
| 354 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 354 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 355 return; | 355 return; |
| 356 } | 356 } |
| 357 | 357 |
| 358 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &MetadataRequest::didGetEntry); | 358 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &MetadataRequest::didGetEntry); |
| 359 OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::creat
e(successCallback, errorCallback, scriptExecutionContext, type, m_path); | 359 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, scriptExecutionContext, type, m_path); |
| 360 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); | 360 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); |
| 361 } | 361 } |
| 362 | 362 |
| 363 bool MetadataRequest::didGetEntry(Entry* entry) | 363 bool MetadataRequest::didGetEntry(Entry* entry) |
| 364 { | 364 { |
| 365 if (!entry->filesystem()->scriptExecutionContext()) { | 365 if (!entry->filesystem()->scriptExecutionContext()) { |
| 366 reportResult(FileError::ABORT_ERR); | 366 reportResult(FileError::ABORT_ERR); |
| 367 return true; | 367 return true; |
| 368 } | 368 } |
| 369 | 369 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &FileContentRequest::didHitError); | 455 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &FileContentRequest::didHitError); |
| 456 | 456 |
| 457 FileSystemType type; | 457 FileSystemType type; |
| 458 String path; | 458 String path; |
| 459 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { | 459 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { |
| 460 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 460 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 461 return; | 461 return; |
| 462 } | 462 } |
| 463 | 463 |
| 464 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &FileContentRequest::didGetEntry); | 464 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &FileContentRequest::didGetEntry); |
| 465 OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::creat
e(successCallback, errorCallback, scriptExecutionContext, type, path); | 465 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, scriptExecutionContext, type, path); |
| 466 | 466 |
| 467 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); | 467 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExecutio
nContext, type, fileSystemCallbacks.release()); |
| 468 } | 468 } |
| 469 | 469 |
| 470 bool FileContentRequest::didGetEntry(Entry* entry) | 470 bool FileContentRequest::didGetEntry(Entry* entry) |
| 471 { | 471 { |
| 472 if (entry->isDirectory()) { | 472 if (entry->isDirectory()) { |
| 473 reportResult(FileError::TYPE_MISMATCH_ERR); | 473 reportResult(FileError::TYPE_MISMATCH_ERR); |
| 474 return true; | 474 return true; |
| 475 } | 475 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DeleteEntryRequest::didHitError); | 565 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DeleteEntryRequest::didHitError); |
| 566 | 566 |
| 567 FileSystemType type; | 567 FileSystemType type; |
| 568 String path; | 568 String path; |
| 569 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { | 569 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { |
| 570 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 570 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 571 return; | 571 return; |
| 572 } | 572 } |
| 573 | 573 |
| 574 if (path == "/") { | 574 if (path == "/") { |
| 575 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::cr
eate(this, errorCallback); | 575 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::cr
eate(this, errorCallback, 0); |
| 576 LocalFileSystem::from(scriptExecutionContext)->deleteFileSystem(scriptEx
ecutionContext, type, fileSystemCallbacks.release()); | 576 LocalFileSystem::from(scriptExecutionContext)->deleteFileSystem(scriptEx
ecutionContext, type, fileSystemCallbacks.release()); |
| 577 } else { | 577 } else { |
| 578 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryC
allback>::create(this, &DeleteEntryRequest::didGetEntry); | 578 RefPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryC
allback>::create(this, &DeleteEntryRequest::didGetEntry); |
| 579 OwnPtr<ResolveURICallbacks> fileSystemCallbacks = ResolveURICallbacks::c
reate(successCallback, errorCallback, scriptExecutionContext, type, path); | 579 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbac
ks::create(successCallback, errorCallback, scriptExecutionContext, type, path); |
| 580 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExec
utionContext, type, fileSystemCallbacks.release()); | 580 LocalFileSystem::from(scriptExecutionContext)->readFileSystem(scriptExec
utionContext, type, fileSystemCallbacks.release()); |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 | 583 |
| 584 bool DeleteEntryRequest::didGetEntry(Entry* entry) | 584 bool DeleteEntryRequest::didGetEntry(Entry* entry) |
| 585 { | 585 { |
| 586 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DeleteEntryRequest::didHitError); | 586 RefPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DeleteEntryRequest::didHitError); |
| 587 if (entry->isDirectory()) { | 587 if (entry->isDirectory()) { |
| 588 DirectoryEntry* directoryEntry = static_cast<DirectoryEntry*>(entry); | 588 DirectoryEntry* directoryEntry = static_cast<DirectoryEntry*>(entry); |
| 589 directoryEntry->removeRecursively(this, errorCallback); | 589 directoryEntry->removeRecursively(this, errorCallback); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree()->
traverseNext()) { | 725 for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree()->
traverseNext()) { |
| 726 if (frame->document() && frame->document()->securityOrigin()->isSameSche
meHostPort(origin)) | 726 if (frame->document() && frame->document()->securityOrigin()->isSameSche
meHostPort(origin)) |
| 727 return frame->document(); | 727 return frame->document(); |
| 728 } | 728 } |
| 729 | 729 |
| 730 *error = "No frame is available for the request"; | 730 *error = "No frame is available for the request"; |
| 731 return 0; | 731 return 0; |
| 732 } | 732 } |
| 733 | 733 |
| 734 } // namespace WebCore | 734 } // namespace WebCore |
| OLD | NEW |