Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 bool* created) { | 37 bool* created) { |
| 38 FilePath local_path = | 38 FilePath local_path = |
| 39 GetLocalPath(context, context->src_origin_url(), context->src_type(), | 39 GetLocalPath(context, context->src_origin_url(), context->src_type(), |
| 40 file_path); | 40 file_path); |
| 41 if (local_path.empty()) | 41 if (local_path.empty()) |
| 42 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 42 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| 43 return FileSystemFileUtil::GetInstance()->EnsureFileExists( | 43 return FileSystemFileUtil::GetInstance()->EnsureFileExists( |
| 44 context, local_path, created); | 44 context, local_path, created); |
| 45 } | 45 } |
| 46 | 46 |
| 47 PlatformFileError LocalFileSystemFileUtil::GetLocalFilePath( | |
| 48 FileSystemOperationContext* context, | |
| 49 const FilePath& virtual_path, | |
| 50 FilePath* local_path) { | |
| 51 FileSystemPathManager* manager = | |
| 52 context->file_system_context()->path_manager(); | |
| 53 FilePath path = | |
| 54 manager->GetFileSystemRootPathOnFileThread(context->src_origin_url(), | |
| 55 context->src_type(), | |
| 56 virtual_path, | |
| 57 false); // create | |
|
ericu
2011/04/19 20:30:49
Why is this not using GetLocalPath?
zel
2011/04/19 23:14:00
Good point, didn't noticed that one. Done.
| |
| 58 if (path.empty()) | |
| 59 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | |
| 60 | |
| 61 *local_path = path.Append(virtual_path); | |
| 62 return base::PLATFORM_FILE_OK; | |
| 63 } | |
| 64 | |
| 47 PlatformFileError LocalFileSystemFileUtil::GetFileInfo( | 65 PlatformFileError LocalFileSystemFileUtil::GetFileInfo( |
| 48 FileSystemOperationContext* context, | 66 FileSystemOperationContext* context, |
| 49 const FilePath& file_path, | 67 const FilePath& file_path, |
| 50 base::PlatformFileInfo* file_info, | 68 base::PlatformFileInfo* file_info, |
| 51 FilePath* platform_file_path) { | 69 FilePath* platform_file_path) { |
| 52 FilePath local_path = | 70 FilePath local_path = |
| 53 GetLocalPath(context, context->src_origin_url(), context->src_type(), | 71 GetLocalPath(context, context->src_origin_url(), context->src_type(), |
| 54 file_path); | 72 file_path); |
| 55 if (local_path.empty()) | 73 if (local_path.empty()) |
| 56 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 74 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 FileSystemType type, | 188 FileSystemType type, |
| 171 const FilePath& virtual_path) { | 189 const FilePath& virtual_path) { |
| 172 FilePath root = context->file_system_context()->path_manager()-> | 190 FilePath root = context->file_system_context()->path_manager()-> |
| 173 GetFileSystemRootPathOnFileThread(origin_url, type, virtual_path, false); | 191 GetFileSystemRootPathOnFileThread(origin_url, type, virtual_path, false); |
| 174 if (root.empty()) | 192 if (root.empty()) |
| 175 return FilePath(); | 193 return FilePath(); |
| 176 return root.Append(virtual_path); | 194 return root.Append(virtual_path); |
| 177 } | 195 } |
| 178 | 196 |
| 179 } // namespace fileapi | 197 } // namespace fileapi |
| OLD | NEW |