Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: webkit/fileapi/local_file_system_file_util.cc

Issue 6864040: Fixed file/directory url resolution for external mount point provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 FilePath path =
52 GetLocalPath(context, context->src_origin_url(), context->src_type(),
53 virtual_path);
54 if (path.empty())
55 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
56
57 *local_path = path;
58 return base::PLATFORM_FILE_OK;
59 }
60
47 PlatformFileError LocalFileSystemFileUtil::GetFileInfo( 61 PlatformFileError LocalFileSystemFileUtil::GetFileInfo(
48 FileSystemOperationContext* context, 62 FileSystemOperationContext* context,
49 const FilePath& file_path, 63 const FilePath& file_path,
50 base::PlatformFileInfo* file_info, 64 base::PlatformFileInfo* file_info,
51 FilePath* platform_file_path) { 65 FilePath* platform_file_path) {
52 FilePath local_path = 66 FilePath local_path =
53 GetLocalPath(context, context->src_origin_url(), context->src_type(), 67 GetLocalPath(context, context->src_origin_url(), context->src_type(),
54 file_path); 68 file_path);
55 if (local_path.empty()) 69 if (local_path.empty())
56 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; 70 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return FileSystemFileUtil::GetInstance()->Truncate( 177 return FileSystemFileUtil::GetInstance()->Truncate(
164 context, local_path, length); 178 context, local_path, length);
165 } 179 }
166 180
167 FilePath LocalFileSystemFileUtil::GetLocalPath( 181 FilePath LocalFileSystemFileUtil::GetLocalPath(
168 FileSystemOperationContext* context, 182 FileSystemOperationContext* context,
169 const GURL& origin_url, 183 const GURL& origin_url,
170 FileSystemType type, 184 FileSystemType type,
171 const FilePath& virtual_path) { 185 const FilePath& virtual_path) {
172 FilePath root = context->file_system_context()->path_manager()-> 186 FilePath root = context->file_system_context()->path_manager()->
173 GetFileSystemRootPathOnFileThread(origin_url, type, virtual_path, false); 187 ValidateFileSystemRootAndGetPathOnFileThread(origin_url, type,
188 virtual_path, false);
174 if (root.empty()) 189 if (root.empty())
175 return FilePath(); 190 return FilePath();
176 return root.Append(virtual_path); 191 return root.Append(virtual_path);
177 } 192 }
178 193
179 } // namespace fileapi 194 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698