| 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/local_file_system_file_util.h" | 5 #include "webkit/fileapi/local_file_system_file_util.h" |
| 6 | 6 |
| 7 #include "base/file_util_proxy.h" | 7 #include "base/file_util_proxy.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "webkit/fileapi/file_system_context.h" | 9 #include "webkit/fileapi/file_system_context.h" |
| 10 #include "webkit/fileapi/file_system_operation_context.h" | 10 #include "webkit/fileapi/file_system_operation_context.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 114 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| 115 FilePath local_dest_path = | 115 FilePath local_dest_path = |
| 116 GetLocalPath(context, context->dest_origin_url(), context->dest_type(), | 116 GetLocalPath(context, context->dest_origin_url(), context->dest_type(), |
| 117 dest_file_path); | 117 dest_file_path); |
| 118 if (local_dest_path.empty()) | 118 if (local_dest_path.empty()) |
| 119 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 119 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| 120 return QuotaFileUtil::GetInstance()->CopyOrMoveFile( | 120 return QuotaFileUtil::GetInstance()->CopyOrMoveFile( |
| 121 context, local_src_path, local_dest_path, copy); | 121 context, local_src_path, local_dest_path, copy); |
| 122 } | 122 } |
| 123 | 123 |
| 124 PlatformFileError LocalFileSystemFileUtil::CopyInForeignFile( |
| 125 FileSystemOperationContext* context, |
| 126 const FilePath& src_file_path, |
| 127 const FilePath& dest_file_path) { |
| 128 if (src_file_path.empty()) |
| 129 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| 130 FilePath local_dest_path = |
| 131 GetLocalPath(context, context->dest_origin_url(), context->dest_type(), |
| 132 dest_file_path); |
| 133 if (local_dest_path.empty()) |
| 134 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| 135 return QuotaFileUtil::GetInstance()->CopyOrMoveFile( |
| 136 context, src_file_path, local_dest_path, true); |
| 137 } |
| 138 |
| 124 PlatformFileError LocalFileSystemFileUtil::DeleteFile( | 139 PlatformFileError LocalFileSystemFileUtil::DeleteFile( |
| 125 FileSystemOperationContext* context, | 140 FileSystemOperationContext* context, |
| 126 const FilePath& file_path) { | 141 const FilePath& file_path) { |
| 127 FilePath local_path = | 142 FilePath local_path = |
| 128 GetLocalPath(context, context->src_origin_url(), context->src_type(), | 143 GetLocalPath(context, context->src_origin_url(), context->src_type(), |
| 129 file_path); | 144 file_path); |
| 130 if (local_path.empty()) | 145 if (local_path.empty()) |
| 131 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 146 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| 132 return QuotaFileUtil::GetInstance()->DeleteFile( | 147 return QuotaFileUtil::GetInstance()->DeleteFile( |
| 133 context, local_path); | 148 context, local_path); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 const FilePath& virtual_path) { | 285 const FilePath& virtual_path) { |
| 271 FilePath root = context->file_system_context()->path_manager()-> | 286 FilePath root = context->file_system_context()->path_manager()-> |
| 272 ValidateFileSystemRootAndGetPathOnFileThread(origin_url, type, | 287 ValidateFileSystemRootAndGetPathOnFileThread(origin_url, type, |
| 273 virtual_path, false); | 288 virtual_path, false); |
| 274 if (root.empty()) | 289 if (root.empty()) |
| 275 return FilePath(); | 290 return FilePath(); |
| 276 return root.Append(virtual_path); | 291 return root.Append(virtual_path); |
| 277 } | 292 } |
| 278 | 293 |
| 279 } // namespace fileapi | 294 } // namespace fileapi |
| OLD | NEW |