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

Side by Side Diff: webkit/browser/fileapi/local_file_util.cc

Issue 274903002: Remove PlatformFile from fileapi::FileSystemFileUtil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 6 years, 7 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
« no previous file with comments | « webkit/browser/fileapi/local_file_util.h ('k') | webkit/browser/fileapi/native_file_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/fileapi/local_file_util.h" 5 #include "webkit/browser/fileapi/local_file_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/file_util_proxy.h" 9 #include "base/files/file_util_proxy.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 bool LocalFileEnumerator::IsDirectory() { 71 bool LocalFileEnumerator::IsDirectory() {
72 return file_util_info_.IsDirectory(); 72 return file_util_info_.IsDirectory();
73 } 73 }
74 74
75 LocalFileUtil::LocalFileUtil() {} 75 LocalFileUtil::LocalFileUtil() {}
76 76
77 LocalFileUtil::~LocalFileUtil() {} 77 LocalFileUtil::~LocalFileUtil() {}
78 78
79 base::File::Error LocalFileUtil::CreateOrOpen( 79 base::File LocalFileUtil::CreateOrOpen(
80 FileSystemOperationContext* context, 80 FileSystemOperationContext* context,
81 const FileSystemURL& url, int file_flags, 81 const FileSystemURL& url, int file_flags) {
82 base::PlatformFile* file_handle, bool* created) {
83 *created = false;
84 base::FilePath file_path; 82 base::FilePath file_path;
85 base::File::Error error = GetLocalFilePath(context, url, &file_path); 83 base::File::Error error = GetLocalFilePath(context, url, &file_path);
86 if (error != base::File::FILE_OK) 84 if (error != base::File::FILE_OK)
87 return error; 85 return base::File(error);
88 // Disallow opening files in symlinked paths. 86 // Disallow opening files in symlinked paths.
89 if (base::IsLink(file_path)) 87 if (base::IsLink(file_path))
90 return base::File::FILE_ERROR_NOT_FOUND; 88 return base::File(base::File::FILE_ERROR_NOT_FOUND);
91 89
92 // TODO(rvargas): make FileSystemFileUtil use base::File. 90 return NativeFileUtil::CreateOrOpen(file_path, file_flags);
93 base::File file = NativeFileUtil::CreateOrOpen(file_path, file_flags);
94 if (!file.IsValid())
95 return file.error_details();
96
97 *created = file.created();
98 *file_handle = file.TakePlatformFile();
99 return base::File::FILE_OK;
100 }
101
102 base::File::Error LocalFileUtil::Close(FileSystemOperationContext* context,
103 base::PlatformFile file) {
104 base::File auto_closed(file);
105 return base::File::FILE_OK;
106 } 91 }
107 92
108 base::File::Error LocalFileUtil::EnsureFileExists( 93 base::File::Error LocalFileUtil::EnsureFileExists(
109 FileSystemOperationContext* context, 94 FileSystemOperationContext* context,
110 const FileSystemURL& url, 95 const FileSystemURL& url,
111 bool* created) { 96 bool* created) {
112 base::FilePath file_path; 97 base::FilePath file_path;
113 base::File::Error error = GetLocalFilePath(context, url, &file_path); 98 base::File::Error error = GetLocalFilePath(context, url, &file_path);
114 if (error != base::File::FILE_OK) 99 if (error != base::File::FILE_OK)
115 return error; 100 return error;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 base::FilePath* platform_path) { 252 base::FilePath* platform_path) {
268 DCHECK(file_info); 253 DCHECK(file_info);
269 // We're just returning the local file information. 254 // We're just returning the local file information.
270 *error = GetFileInfo(context, url, file_info, platform_path); 255 *error = GetFileInfo(context, url, file_info, platform_path);
271 if (*error == base::File::FILE_OK && file_info->is_directory) 256 if (*error == base::File::FILE_OK && file_info->is_directory)
272 *error = base::File::FILE_ERROR_NOT_A_FILE; 257 *error = base::File::FILE_ERROR_NOT_A_FILE;
273 return webkit_blob::ScopedFile(); 258 return webkit_blob::ScopedFile();
274 } 259 }
275 260
276 } // namespace fileapi 261 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/local_file_util.h ('k') | webkit/browser/fileapi/native_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698