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 "webkit/fileapi/local_file_system_operation.h" | 5 #include "webkit/fileapi/local_file_system_operation.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 callback.Run(result, file_info, platform_path, file_ref); | 731 callback.Run(result, file_info, platform_path, file_ref); |
732 } | 732 } |
733 | 733 |
734 base::PlatformFileError LocalFileSystemOperation::SetUp( | 734 base::PlatformFileError LocalFileSystemOperation::SetUp( |
735 const FileSystemURL& url, | 735 const FileSystemURL& url, |
736 FileSystemFileUtil** file_util, | 736 FileSystemFileUtil** file_util, |
737 SetUpMode mode) { | 737 SetUpMode mode) { |
738 if (!url.is_valid()) | 738 if (!url.is_valid()) |
739 return base::PLATFORM_FILE_ERROR_INVALID_URL; | 739 return base::PLATFORM_FILE_ERROR_INVALID_URL; |
740 | 740 |
| 741 // Restricted file system is read-only. |
| 742 if (url.type() == fileapi::kFileSystemTypeRestrictedNativeLocal && |
| 743 mode != SETUP_FOR_READ) |
| 744 return base::PLATFORM_FILE_ERROR_SECURITY; |
| 745 |
741 if (!file_system_context()->GetMountPointProvider( | 746 if (!file_system_context()->GetMountPointProvider( |
742 url.type())->IsAccessAllowed(url)) | 747 url.type())->IsAccessAllowed(url)) |
743 return base::PLATFORM_FILE_ERROR_SECURITY; | 748 return base::PLATFORM_FILE_ERROR_SECURITY; |
744 | 749 |
745 DCHECK(file_util); | 750 DCHECK(file_util); |
746 if (!*file_util) | 751 if (!*file_util) |
747 *file_util = file_system_context()->GetFileUtil(url.type()); | 752 *file_util = file_system_context()->GetFileUtil(url.type()); |
748 if (!*file_util) | 753 if (!*file_util) |
749 return base::PLATFORM_FILE_ERROR_SECURITY; | 754 return base::PLATFORM_FILE_ERROR_SECURITY; |
750 | 755 |
(...skipping 26 matching lines...) Expand all Loading... |
777 } | 782 } |
778 | 783 |
779 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { | 784 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { |
780 if (pending_operation_ != kOperationNone) | 785 if (pending_operation_ != kOperationNone) |
781 return false; | 786 return false; |
782 pending_operation_ = type; | 787 pending_operation_ = type; |
783 return true; | 788 return true; |
784 } | 789 } |
785 | 790 |
786 } // namespace fileapi | 791 } // namespace fileapi |
OLD | NEW |