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

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: Change API to return File 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 = 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;
94 } 100 }
95 101
96 base::File::Error LocalFileUtil::Close(FileSystemOperationContext* context, 102 base::File::Error LocalFileUtil::Close(FileSystemOperationContext* context,
97 base::PlatformFile file) { 103 base::PlatformFile file) {
98 return NativeFileUtil::Close(file); 104 base::File auto_closed(file);
105 return base::File::FILE_OK;
99 } 106 }
100 107
101 base::File::Error LocalFileUtil::EnsureFileExists( 108 base::File::Error LocalFileUtil::EnsureFileExists(
102 FileSystemOperationContext* context, 109 FileSystemOperationContext* context,
103 const FileSystemURL& url, 110 const FileSystemURL& url,
104 bool* created) { 111 bool* created) {
105 base::FilePath file_path; 112 base::FilePath file_path;
106 base::File::Error error = GetLocalFilePath(context, url, &file_path); 113 base::File::Error error = GetLocalFilePath(context, url, &file_path);
107 if (error != base::File::FILE_OK) 114 if (error != base::File::FILE_OK)
108 return error; 115 return error;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 base::FilePath* platform_path) { 267 base::FilePath* platform_path) {
261 DCHECK(file_info); 268 DCHECK(file_info);
262 // We're just returning the local file information. 269 // We're just returning the local file information.
263 *error = GetFileInfo(context, url, file_info, platform_path); 270 *error = GetFileInfo(context, url, file_info, platform_path);
264 if (*error == base::File::FILE_OK && file_info->is_directory) 271 if (*error == base::File::FILE_OK && file_info->is_directory)
265 *error = base::File::FILE_ERROR_NOT_A_FILE; 272 *error = base::File::FILE_ERROR_NOT_A_FILE;
266 return webkit_blob::ScopedFile(); 273 return webkit_blob::ScopedFile();
267 } 274 }
268 275
269 } // namespace fileapi 276 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698