| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 static const char fileSystemAgentEnabled[] = "fileSystemAgentEnabled"; | 78 static const char fileSystemAgentEnabled[] = "fileSystemAgentEnabled"; |
| 79 } | 79 } |
| 80 | 80 |
| 81 namespace { | 81 namespace { |
| 82 | 82 |
| 83 template<typename BaseCallback, typename Handler, typename Argument> | 83 template<typename BaseCallback, typename Handler, typename Argument> |
| 84 class CallbackDispatcher FINAL : public BaseCallback { | 84 class CallbackDispatcher FINAL : public BaseCallback { |
| 85 public: | 85 public: |
| 86 typedef bool (Handler::*HandlingMethod)(Argument); | 86 typedef bool (Handler::*HandlingMethod)(Argument); |
| 87 | 87 |
| 88 static PassOwnPtrWillBeRawPtr<CallbackDispatcher> create(PassRefPtr<Handler>
handler, HandlingMethod handlingMethod) | 88 static CallbackDispatcher* create(PassRefPtr<Handler> handler, HandlingMetho
d handlingMethod) |
| 89 { | 89 { |
| 90 return adoptPtrWillBeNoop(new CallbackDispatcher(handler, handlingMethod
)); | 90 return new CallbackDispatcher(handler, handlingMethod); |
| 91 } | 91 } |
| 92 | 92 |
| 93 virtual void handleEvent(Argument argument) OVERRIDE | 93 virtual void handleEvent(Argument argument) OVERRIDE |
| 94 { | 94 { |
| 95 (m_handler.get()->*m_handlingMethod)(argument); | 95 (m_handler.get()->*m_handlingMethod)(argument); |
| 96 } | 96 } |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 CallbackDispatcher(PassRefPtr<Handler> handler, HandlingMethod handlingMetho
d) | 99 CallbackDispatcher(PassRefPtr<Handler> handler, HandlingMethod handlingMetho
d) |
| 100 : m_handler(handler) | 100 : m_handler(handler) |
| 101 , m_handlingMethod(handlingMethod) { } | 101 , m_handlingMethod(handlingMethod) { } |
| 102 | 102 |
| 103 RefPtr<Handler> m_handler; | 103 RefPtr<Handler> m_handler; |
| 104 HandlingMethod m_handlingMethod; | 104 HandlingMethod m_handlingMethod; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 template<typename BaseCallback> | 107 template<typename BaseCallback> |
| 108 class CallbackDispatcherFactory { | 108 class CallbackDispatcherFactory { |
| 109 public: | 109 public: |
| 110 template<typename Handler, typename Argument> | 110 template<typename Handler, typename Argument> |
| 111 static PassOwnPtrWillBeRawPtr<CallbackDispatcher<BaseCallback, Handler, Argu
ment> > create(Handler* handler, bool (Handler::*handlingMethod)(Argument)) | 111 static CallbackDispatcher<BaseCallback, Handler, Argument>* create(Handler*
handler, bool (Handler::*handlingMethod)(Argument)) |
| 112 { | 112 { |
| 113 return CallbackDispatcher<BaseCallback, Handler, Argument>::create(PassR
efPtr<Handler>(handler), handlingMethod); | 113 return CallbackDispatcher<BaseCallback, Handler, Argument>::create(PassR
efPtr<Handler>(handler), handlingMethod); |
| 114 } | 114 } |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 class FileSystemRootRequest : public RefCounted<FileSystemRootRequest> { | 117 class FileSystemRootRequest : public RefCounted<FileSystemRootRequest> { |
| 118 WTF_MAKE_NONCOPYABLE(FileSystemRootRequest); | 118 WTF_MAKE_NONCOPYABLE(FileSystemRootRequest); |
| 119 public: | 119 public: |
| 120 static PassRefPtr<FileSystemRootRequest> create(PassRefPtrWillBeRawPtr<Reque
stFileSystemRootCallback> requestCallback, const String& type) | 120 static PassRefPtr<FileSystemRootRequest> create(PassRefPtrWillBeRawPtr<Reque
stFileSystemRootCallback> requestCallback, const String& type) |
| 121 { | 121 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 143 , m_type(type) { } | 143 , m_type(type) { } |
| 144 | 144 |
| 145 RefPtrWillBePersistent<RequestFileSystemRootCallback> m_requestCallback; | 145 RefPtrWillBePersistent<RequestFileSystemRootCallback> m_requestCallback; |
| 146 String m_type; | 146 String m_type; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 void FileSystemRootRequest::start(ExecutionContext* executionContext) | 149 void FileSystemRootRequest::start(ExecutionContext* executionContext) |
| 150 { | 150 { |
| 151 ASSERT(executionContext); | 151 ASSERT(executionContext); |
| 152 | 152 |
| 153 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &FileSystemRootRequest::didHitError); | 153 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &FileSystemRootRequest::didHitError); |
| 154 | 154 |
| 155 FileSystemType type; | 155 FileSystemType type; |
| 156 if (!DOMFileSystemBase::pathPrefixToFileSystemType(m_type, type)) { | 156 if (!DOMFileSystemBase::pathPrefixToFileSystemType(m_type, type)) { |
| 157 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 157 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 158 return; | 158 return; |
| 159 } | 159 } |
| 160 | 160 |
| 161 KURL rootURL = DOMFileSystemBase::createFileSystemRootURL(executionContext->
securityOrigin()->toString(), type); | 161 KURL rootURL = DOMFileSystemBase::createFileSystemRootURL(executionContext->
securityOrigin()->toString(), type); |
| 162 if (!rootURL.isValid()) { | 162 if (!rootURL.isValid()) { |
| 163 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 163 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 164 return; | 164 return; |
| 165 } | 165 } |
| 166 | 166 |
| 167 OwnPtrWillBeRawPtr<EntryCallback> successCallback = CallbackDispatcherFactor
y<EntryCallback>::create(this, &FileSystemRootRequest::didGetEntry); | 167 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c
reate(this, &FileSystemRootRequest::didGetEntry); |
| 168 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); | 168 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, executionContext); |
| 169 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, rootU
RL, fileSystemCallbacks.release()); | 169 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, rootU
RL, fileSystemCallbacks.release()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool FileSystemRootRequest::didGetEntry(Entry* entry) | 172 bool FileSystemRootRequest::didGetEntry(Entry* entry) |
| 173 { | 173 { |
| 174 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent
ry::create() | 174 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent
ry::create() |
| 175 .setUrl(entry->toURL()) | 175 .setUrl(entry->toURL()) |
| 176 .setName("/") | 176 .setName("/") |
| 177 .setIsDirectory(true); | 177 .setIsDirectory(true); |
| 178 reportResult(static_cast<FileError::ErrorCode>(0), result); | 178 reportResult(static_cast<FileError::ErrorCode>(0), result); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 RefPtrWillBePersistent<RequestDirectoryContentCallback> m_requestCallback; | 218 RefPtrWillBePersistent<RequestDirectoryContentCallback> m_requestCallback; |
| 219 KURL m_url; | 219 KURL m_url; |
| 220 RefPtr<Array<TypeBuilder::FileSystem::Entry> > m_entries; | 220 RefPtr<Array<TypeBuilder::FileSystem::Entry> > m_entries; |
| 221 Persistent<DirectoryReader> m_directoryReader; | 221 Persistent<DirectoryReader> m_directoryReader; |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 void DirectoryContentRequest::start(ExecutionContext* executionContext) | 224 void DirectoryContentRequest::start(ExecutionContext* executionContext) |
| 225 { | 225 { |
| 226 ASSERT(executionContext); | 226 ASSERT(executionContext); |
| 227 | 227 |
| 228 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &DirectoryContentRequest::didHitError); | 228 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &DirectoryContentRequest::didHitError); |
| 229 OwnPtrWillBeRawPtr<EntryCallback> successCallback = CallbackDispatcherFactor
y<EntryCallback>::create(this, &DirectoryContentRequest::didGetEntry); | 229 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c
reate(this, &DirectoryContentRequest::didGetEntry); |
| 230 | 230 |
| 231 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); | 231 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, executionContext); |
| 232 | 232 |
| 233 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url
, fileSystemCallbacks.release()); | 233 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url
, fileSystemCallbacks.release()); |
| 234 } | 234 } |
| 235 | 235 |
| 236 bool DirectoryContentRequest::didGetEntry(Entry* entry) | 236 bool DirectoryContentRequest::didGetEntry(Entry* entry) |
| 237 { | 237 { |
| 238 if (!entry->isDirectory()) { | 238 if (!entry->isDirectory()) { |
| 239 reportResult(FileError::TYPE_MISMATCH_ERR); | 239 reportResult(FileError::TYPE_MISMATCH_ERR); |
| 240 return true; | 240 return true; |
| 241 } | 241 } |
| 242 | 242 |
| 243 m_directoryReader = toDirectoryEntry(entry)->createReader(); | 243 m_directoryReader = toDirectoryEntry(entry)->createReader(); |
| 244 m_entries = Array<TypeBuilder::FileSystem::Entry>::create(); | 244 m_entries = Array<TypeBuilder::FileSystem::Entry>::create(); |
| 245 readDirectoryEntries(); | 245 readDirectoryEntries(); |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 void DirectoryContentRequest::readDirectoryEntries() | 249 void DirectoryContentRequest::readDirectoryEntries() |
| 250 { | 250 { |
| 251 if (!m_directoryReader->filesystem()->executionContext()) { | 251 if (!m_directoryReader->filesystem()->executionContext()) { |
| 252 reportResult(FileError::ABORT_ERR); | 252 reportResult(FileError::ABORT_ERR); |
| 253 return; | 253 return; |
| 254 } | 254 } |
| 255 | 255 |
| 256 OwnPtrWillBeRawPtr<EntriesCallback> successCallback = CallbackDispatcherFact
ory<EntriesCallback>::create(this, &DirectoryContentRequest::didReadDirectoryEnt
ries); | 256 EntriesCallback* successCallback = CallbackDispatcherFactory<EntriesCallback
>::create(this, &DirectoryContentRequest::didReadDirectoryEntries); |
| 257 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &DirectoryContentRequest::didHitError); | 257 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &DirectoryContentRequest::didHitError); |
| 258 m_directoryReader->readEntries(successCallback.release(), errorCallback.rele
ase()); | 258 m_directoryReader->readEntries(successCallback, errorCallback); |
| 259 } | 259 } |
| 260 | 260 |
| 261 bool DirectoryContentRequest::didReadDirectoryEntries(const EntryHeapVector& ent
ries) | 261 bool DirectoryContentRequest::didReadDirectoryEntries(const EntryHeapVector& ent
ries) |
| 262 { | 262 { |
| 263 if (entries.isEmpty()) { | 263 if (entries.isEmpty()) { |
| 264 reportResult(static_cast<FileError::ErrorCode>(0), m_entries); | 264 reportResult(static_cast<FileError::ErrorCode>(0), m_entries); |
| 265 return true; | 265 return true; |
| 266 } | 266 } |
| 267 | 267 |
| 268 for (size_t i = 0; i < entries.size(); ++i) { | 268 for (size_t i = 0; i < entries.size(); ++i) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 RefPtrWillBePersistent<RequestMetadataCallback> m_requestCallback; | 337 RefPtrWillBePersistent<RequestMetadataCallback> m_requestCallback; |
| 338 KURL m_url; | 338 KURL m_url; |
| 339 bool m_isDirectory; | 339 bool m_isDirectory; |
| 340 }; | 340 }; |
| 341 | 341 |
| 342 void MetadataRequest::start(ExecutionContext* executionContext) | 342 void MetadataRequest::start(ExecutionContext* executionContext) |
| 343 { | 343 { |
| 344 ASSERT(executionContext); | 344 ASSERT(executionContext); |
| 345 | 345 |
| 346 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &MetadataRequest::didHitError); | 346 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &MetadataRequest::didHitError); |
| 347 OwnPtrWillBeRawPtr<EntryCallback> successCallback = CallbackDispatcherFactor
y<EntryCallback>::create(this, &MetadataRequest::didGetEntry); | 347 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c
reate(this, &MetadataRequest::didGetEntry); |
| 348 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); | 348 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, executionContext); |
| 349 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url
, fileSystemCallbacks.release()); | 349 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url
, fileSystemCallbacks.release()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 bool MetadataRequest::didGetEntry(Entry* entry) | 352 bool MetadataRequest::didGetEntry(Entry* entry) |
| 353 { | 353 { |
| 354 if (!entry->filesystem()->executionContext()) { | 354 if (!entry->filesystem()->executionContext()) { |
| 355 reportResult(FileError::ABORT_ERR); | 355 reportResult(FileError::ABORT_ERR); |
| 356 return true; | 356 return true; |
| 357 } | 357 } |
| 358 | 358 |
| 359 OwnPtrWillBeRawPtr<MetadataCallback> successCallback = CallbackDispatcherFac
tory<MetadataCallback>::create(this, &MetadataRequest::didGetMetadata); | 359 MetadataCallback* successCallback = CallbackDispatcherFactory<MetadataCallba
ck>::create(this, &MetadataRequest::didGetMetadata); |
| 360 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &MetadataRequest::didHitError); | 360 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &MetadataRequest::didHitError); |
| 361 entry->getMetadata(successCallback.release(), errorCallback.release()); | 361 entry->getMetadata(successCallback, errorCallback); |
| 362 m_isDirectory = entry->isDirectory(); | 362 m_isDirectory = entry->isDirectory(); |
| 363 return true; | 363 return true; |
| 364 } | 364 } |
| 365 | 365 |
| 366 bool MetadataRequest::didGetMetadata(Metadata* metadata) | 366 bool MetadataRequest::didGetMetadata(Metadata* metadata) |
| 367 { | 367 { |
| 368 using TypeBuilder::FileSystem::Metadata; | 368 using TypeBuilder::FileSystem::Metadata; |
| 369 RefPtr<Metadata> result = Metadata::create() | 369 RefPtr<Metadata> result = Metadata::create() |
| 370 .setModificationTime(metadata->modificationTime()) | 370 .setModificationTime(metadata->modificationTime()) |
| 371 .setSize(metadata->size()); | 371 .setSize(metadata->size()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 String m_mimeType; | 434 String m_mimeType; |
| 435 String m_charset; | 435 String m_charset; |
| 436 | 436 |
| 437 RefPtrWillBePersistent<FileReader> m_reader; | 437 RefPtrWillBePersistent<FileReader> m_reader; |
| 438 }; | 438 }; |
| 439 | 439 |
| 440 void FileContentRequest::start(ExecutionContext* executionContext) | 440 void FileContentRequest::start(ExecutionContext* executionContext) |
| 441 { | 441 { |
| 442 ASSERT(executionContext); | 442 ASSERT(executionContext); |
| 443 | 443 |
| 444 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &FileContentRequest::didHitError); | 444 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &FileContentRequest::didHitError); |
| 445 OwnPtrWillBeRawPtr<EntryCallback> successCallback = CallbackDispatcherFactor
y<EntryCallback>::create(this, &FileContentRequest::didGetEntry); | 445 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback>::c
reate(this, &FileContentRequest::didGetEntry); |
| 446 | 446 |
| 447 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); | 447 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback, errorCallback, executionContext); |
| 448 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url
, fileSystemCallbacks.release()); | 448 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url
, fileSystemCallbacks.release()); |
| 449 } | 449 } |
| 450 | 450 |
| 451 bool FileContentRequest::didGetEntry(Entry* entry) | 451 bool FileContentRequest::didGetEntry(Entry* entry) |
| 452 { | 452 { |
| 453 if (entry->isDirectory()) { | 453 if (entry->isDirectory()) { |
| 454 reportResult(FileError::TYPE_MISMATCH_ERR); | 454 reportResult(FileError::TYPE_MISMATCH_ERR); |
| 455 return true; | 455 return true; |
| 456 } | 456 } |
| 457 | 457 |
| 458 if (!entry->filesystem()->executionContext()) { | 458 if (!entry->filesystem()->executionContext()) { |
| 459 reportResult(FileError::ABORT_ERR); | 459 reportResult(FileError::ABORT_ERR); |
| 460 return true; | 460 return true; |
| 461 } | 461 } |
| 462 | 462 |
| 463 OwnPtrWillBeRawPtr<FileCallback> successCallback = CallbackDispatcherFactory
<FileCallback>::create(this, &FileContentRequest::didGetFile); | 463 FileCallback* successCallback = CallbackDispatcherFactory<FileCallback>::cre
ate(this, &FileContentRequest::didGetFile); |
| 464 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &FileContentRequest::didHitError); | 464 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &FileContentRequest::didHitError); |
| 465 toFileEntry(entry)->file(successCallback.release(), errorCallback.release())
; | 465 toFileEntry(entry)->file(successCallback, errorCallback); |
| 466 | 466 |
| 467 m_reader = FileReader::create(entry->filesystem()->executionContext()); | 467 m_reader = FileReader::create(entry->filesystem()->executionContext()); |
| 468 m_mimeType = MIMETypeRegistry::getMIMETypeForPath(entry->name()); | 468 m_mimeType = MIMETypeRegistry::getMIMETypeForPath(entry->name()); |
| 469 | 469 |
| 470 return true; | 470 return true; |
| 471 } | 471 } |
| 472 | 472 |
| 473 bool FileContentRequest::didGetFile(File* file) | 473 bool FileContentRequest::didGetFile(File* file) |
| 474 { | 474 { |
| 475 RefPtrWillBeRawPtr<Blob> blob = static_cast<Blob*>(file)->slice(m_start, m_e
nd, IGNORE_EXCEPTION); | 475 RefPtrWillBeRawPtr<Blob> blob = static_cast<Blob*>(file)->slice(m_start, m_e
nd, IGNORE_EXCEPTION); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 , m_url(url) { } | 548 , m_url(url) { } |
| 549 | 549 |
| 550 RefPtrWillBePersistent<DeleteEntryCallback> m_requestCallback; | 550 RefPtrWillBePersistent<DeleteEntryCallback> m_requestCallback; |
| 551 KURL m_url; | 551 KURL m_url; |
| 552 }; | 552 }; |
| 553 | 553 |
| 554 void DeleteEntryRequest::start(ExecutionContext* executionContext) | 554 void DeleteEntryRequest::start(ExecutionContext* executionContext) |
| 555 { | 555 { |
| 556 ASSERT(executionContext); | 556 ASSERT(executionContext); |
| 557 | 557 |
| 558 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &DeleteEntryRequest::didHitError); | 558 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &DeleteEntryRequest::didHitError); |
| 559 | 559 |
| 560 FileSystemType type; | 560 FileSystemType type; |
| 561 String path; | 561 String path; |
| 562 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { | 562 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { |
| 563 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); | 563 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get(
)); |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 | 566 |
| 567 if (path == "/") { | 567 if (path == "/") { |
| 568 OwnPtrWillBeRawPtr<VoidCallback> successCallback = adoptPtrWillBeNoop(ne
w VoidCallbackImpl(this)); | 568 VoidCallback* successCallback = new VoidCallbackImpl(this); |
| 569 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::cr
eate(successCallback.release(), errorCallback.release(), executionContext, nullp
tr); | 569 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::cr
eate(successCallback, errorCallback, executionContext, nullptr); |
| 570 LocalFileSystem::from(*executionContext)->deleteFileSystem(executionCont
ext, type, fileSystemCallbacks.release()); | 570 LocalFileSystem::from(*executionContext)->deleteFileSystem(executionCont
ext, type, fileSystemCallbacks.release()); |
| 571 } else { | 571 } else { |
| 572 OwnPtrWillBeRawPtr<EntryCallback> successCallback = CallbackDispatcherFa
ctory<EntryCallback>::create(this, &DeleteEntryRequest::didGetEntry); | 572 EntryCallback* successCallback = CallbackDispatcherFactory<EntryCallback
>::create(this, &DeleteEntryRequest::didGetEntry); |
| 573 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbac
ks::create(successCallback.release(), errorCallback.release(), executionContext)
; | 573 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbac
ks::create(successCallback, errorCallback, executionContext); |
| 574 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m
_url, fileSystemCallbacks.release()); | 574 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m
_url, fileSystemCallbacks.release()); |
| 575 } | 575 } |
| 576 } | 576 } |
| 577 | 577 |
| 578 bool DeleteEntryRequest::didGetEntry(Entry* entry) | 578 bool DeleteEntryRequest::didGetEntry(Entry* entry) |
| 579 { | 579 { |
| 580 OwnPtrWillBeRawPtr<VoidCallback> successCallback = adoptPtrWillBeNoop(new Vo
idCallbackImpl(this)); | 580 VoidCallback* successCallback = new VoidCallbackImpl(this); |
| 581 OwnPtrWillBeRawPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<
ErrorCallback>::create(this, &DeleteEntryRequest::didHitError); | 581 ErrorCallback* errorCallback = CallbackDispatcherFactory<ErrorCallback>::cre
ate(this, &DeleteEntryRequest::didHitError); |
| 582 if (entry->isDirectory()) { | 582 if (entry->isDirectory()) { |
| 583 DirectoryEntry* directoryEntry = toDirectoryEntry(entry); | 583 DirectoryEntry* directoryEntry = toDirectoryEntry(entry); |
| 584 directoryEntry->removeRecursively(successCallback.release(), errorCallba
ck.release()); | 584 directoryEntry->removeRecursively(successCallback, errorCallback); |
| 585 } else { | 585 } else { |
| 586 entry->remove(successCallback.release(), errorCallback.release()); | 586 entry->remove(successCallback, errorCallback); |
| 587 } | 587 } |
| 588 return true; | 588 return true; |
| 589 } | 589 } |
| 590 | 590 |
| 591 bool DeleteEntryRequest::didDeleteEntry() | 591 bool DeleteEntryRequest::didDeleteEntry() |
| 592 { | 592 { |
| 593 reportResult(static_cast<FileError::ErrorCode>(0)); | 593 reportResult(static_cast<FileError::ErrorCode>(0)); |
| 594 return true; | 594 return true; |
| 595 } | 595 } |
| 596 | 596 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 return 0; | 728 return 0; |
| 729 } | 729 } |
| 730 | 730 |
| 731 void InspectorFileSystemAgent::trace(Visitor* visitor) | 731 void InspectorFileSystemAgent::trace(Visitor* visitor) |
| 732 { | 732 { |
| 733 visitor->trace(m_page); | 733 visitor->trace(m_page); |
| 734 InspectorBaseAgent::trace(visitor); | 734 InspectorBaseAgent::trace(visitor); |
| 735 } | 735 } |
| 736 | 736 |
| 737 } // namespace blink | 737 } // namespace blink |
| OLD | NEW |