| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/fileapi/file_system_operation.h" | 5 #include "webkit/fileapi/file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "net/url_request/url_request_context.h" | 8 #include "net/url_request/url_request_context.h" |
| 9 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 9 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| 10 #include "webkit/fileapi/file_system_context.h" | 10 #include "webkit/fileapi/file_system_context.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } else if (rv == base::PLATFORM_FILE_OK) { | 446 } else if (rv == base::PLATFORM_FILE_OK) { |
| 447 dispatcher_->DidSucceed(); | 447 dispatcher_->DidSucceed(); |
| 448 } else { | 448 } else { |
| 449 dispatcher_->DidFail(rv); | 449 dispatcher_->DidFail(rv); |
| 450 } | 450 } |
| 451 delete this; | 451 delete this; |
| 452 } | 452 } |
| 453 | 453 |
| 454 void FileSystemOperation::DidDirectoryExists( | 454 void FileSystemOperation::DidDirectoryExists( |
| 455 base::PlatformFileError rv, | 455 base::PlatformFileError rv, |
| 456 const base::PlatformFileInfo& file_info) { | 456 const base::PlatformFileInfo& file_info, |
| 457 const FilePath& unused) { |
| 457 if (rv == base::PLATFORM_FILE_OK) { | 458 if (rv == base::PLATFORM_FILE_OK) { |
| 458 if (file_info.is_directory) | 459 if (file_info.is_directory) |
| 459 dispatcher_->DidSucceed(); | 460 dispatcher_->DidSucceed(); |
| 460 else | 461 else |
| 461 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY); | 462 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY); |
| 462 } else { | 463 } else { |
| 463 dispatcher_->DidFail(rv); | 464 dispatcher_->DidFail(rv); |
| 464 } | 465 } |
| 465 delete this; | 466 delete this; |
| 466 } | 467 } |
| 467 | 468 |
| 468 void FileSystemOperation::DidFileExists( | 469 void FileSystemOperation::DidFileExists( |
| 469 base::PlatformFileError rv, | 470 base::PlatformFileError rv, |
| 470 const base::PlatformFileInfo& file_info) { | 471 const base::PlatformFileInfo& file_info, |
| 472 const FilePath& unused) { |
| 471 if (rv == base::PLATFORM_FILE_OK) { | 473 if (rv == base::PLATFORM_FILE_OK) { |
| 472 if (file_info.is_directory) | 474 if (file_info.is_directory) |
| 473 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_FILE); | 475 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_FILE); |
| 474 else | 476 else |
| 475 dispatcher_->DidSucceed(); | 477 dispatcher_->DidSucceed(); |
| 476 } else { | 478 } else { |
| 477 dispatcher_->DidFail(rv); | 479 dispatcher_->DidFail(rv); |
| 478 } | 480 } |
| 479 delete this; | 481 delete this; |
| 480 } | 482 } |
| 481 | 483 |
| 482 void FileSystemOperation::DidGetMetadata( | 484 void FileSystemOperation::DidGetMetadata( |
| 483 base::PlatformFileError rv, | 485 base::PlatformFileError rv, |
| 484 const base::PlatformFileInfo& file_info) { | 486 const base::PlatformFileInfo& file_info, |
| 487 const FilePath& platform_path) { |
| 485 if (rv == base::PLATFORM_FILE_OK) | 488 if (rv == base::PLATFORM_FILE_OK) |
| 486 dispatcher_->DidReadMetadata(file_info); | 489 dispatcher_->DidReadMetadata(file_info, platform_path); |
| 487 else | 490 else |
| 488 dispatcher_->DidFail(rv); | 491 dispatcher_->DidFail(rv); |
| 489 delete this; | 492 delete this; |
| 490 } | 493 } |
| 491 | 494 |
| 492 void FileSystemOperation::DidReadDirectory( | 495 void FileSystemOperation::DidReadDirectory( |
| 493 base::PlatformFileError rv, | 496 base::PlatformFileError rv, |
| 494 const std::vector<base::FileUtilProxy::Entry>& entries) { | 497 const std::vector<base::FileUtilProxy::Entry>& entries) { |
| 495 if (rv == base::PLATFORM_FILE_OK) | 498 if (rv == base::PLATFORM_FILE_OK) |
| 496 dispatcher_->DidReadDirectory(entries, false /* has_more */); | 499 dispatcher_->DidReadDirectory(entries, false /* has_more */); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 586 } |
| 584 // TODO(kinuko): the check must be moved to QuotaFileSystemFileUtil. | 587 // TODO(kinuko): the check must be moved to QuotaFileSystemFileUtil. |
| 585 if (!file_system_context()->IsStorageUnlimited(*origin_url)) { | 588 if (!file_system_context()->IsStorageUnlimited(*origin_url)) { |
| 586 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NO_SPACE); | 589 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NO_SPACE); |
| 587 return false; | 590 return false; |
| 588 } | 591 } |
| 589 return true; | 592 return true; |
| 590 } | 593 } |
| 591 | 594 |
| 592 } // namespace fileapi | 595 } // namespace fileapi |
| OLD | NEW |