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

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

Issue 206783004: Remove PlatforFile from fileapi/native_file_util (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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) 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::PlatformFile* file_handle, bool* created) { 82 base::PlatformFile* file_handle, bool* created) {
83 *created = false; 83 *created = false;
84 base::FilePath file_path; 84 base::FilePath file_path;
85 base::File::Error error = GetLocalFilePath(context, url, &file_path); 85 base::File::Error error = GetLocalFilePath(context, url, &file_path);
86 if (error != base::File::FILE_OK) 86 if (error != base::File::FILE_OK)
87 return error; 87 return error;
88 // Disallow opening files in symlinked paths. 88 // Disallow opening files in symlinked paths.
89 if (base::IsLink(file_path)) 89 if (base::IsLink(file_path))
90 return base::File::FILE_ERROR_NOT_FOUND; 90 return base::File::FILE_ERROR_NOT_FOUND;
91 91
92 return NativeFileUtil::CreateOrOpen(file_path, file_flags, file_handle, 92 // TODO(rvargas): make FileSystemFileUtil use base::File.
93 created); 93 base::File file;
94 error = NativeFileUtil::CreateOrOpen(file_path, file_flags, &file);
95 if (error != base::File::FILE_OK)
96 return error;
97
98 *created = file.created();
99 *file_handle = file.TakePlatformFile();
100 return base::File::FILE_OK;
94 } 101 }
95 102
96 base::File::Error LocalFileUtil::Close(FileSystemOperationContext* context, 103 base::File::Error LocalFileUtil::Close(FileSystemOperationContext* context,
97 base::PlatformFile file) { 104 base::PlatformFile file) {
98 return NativeFileUtil::Close(file); 105 base::File auto_closed(file);
106 return base::File::FILE_OK;
99 } 107 }
100 108
101 base::File::Error LocalFileUtil::EnsureFileExists( 109 base::File::Error LocalFileUtil::EnsureFileExists(
102 FileSystemOperationContext* context, 110 FileSystemOperationContext* context,
103 const FileSystemURL& url, 111 const FileSystemURL& url,
104 bool* created) { 112 bool* created) {
105 base::FilePath file_path; 113 base::FilePath file_path;
106 base::File::Error error = GetLocalFilePath(context, url, &file_path); 114 base::File::Error error = GetLocalFilePath(context, url, &file_path);
107 if (error != base::File::FILE_OK) 115 if (error != base::File::FILE_OK)
108 return error; 116 return error;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 base::FilePath* platform_path) { 268 base::FilePath* platform_path) {
261 DCHECK(file_info); 269 DCHECK(file_info);
262 // We're just returning the local file information. 270 // We're just returning the local file information.
263 *error = GetFileInfo(context, url, file_info, platform_path); 271 *error = GetFileInfo(context, url, file_info, platform_path);
264 if (*error == base::File::FILE_OK && file_info->is_directory) 272 if (*error == base::File::FILE_OK && file_info->is_directory)
265 *error = base::File::FILE_ERROR_NOT_A_FILE; 273 *error = base::File::FILE_ERROR_NOT_A_FILE;
266 return webkit_blob::ScopedFile(); 274 return webkit_blob::ScopedFile();
267 } 275 }
268 276
269 } // namespace fileapi 277 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698