Chromium Code Reviews| Index: content/child/webfileutilities_impl.cc |
| diff --git a/content/child/webfileutilities_impl.cc b/content/child/webfileutilities_impl.cc |
| index 9c055966fd691a43eb09f70246ff75dbcf0d02c0..eb54cb95b1f2d7a31e69f9706b7ce6ed0f304949 100644 |
| --- a/content/child/webfileutilities_impl.cc |
| +++ b/content/child/webfileutilities_impl.cc |
| @@ -31,7 +31,6 @@ bool WebFileUtilitiesImpl::getFileInfo(const WebString& path, |
| NOTREACHED(); |
| return false; |
| } |
| - // TODO(rvargas): convert this code to use base::File::Info. |
| base::File::Info file_info; |
| if (!base::GetFileInfo(base::FilePath::FromUTF16Unsafe(path), |
| reinterpret_cast<base::File::Info*>(&file_info))) |
| @@ -54,34 +53,21 @@ blink::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) { |
| return net::FilePathToFileURL(base::FilePath::FromUTF16Unsafe(path)); |
| } |
| -base::PlatformFile WebFileUtilitiesImpl::openFile(const WebString& path, |
| - int mode) { |
| +base::File WebFileUtilitiesImpl::openFile(const WebString& path) { |
| if (sandbox_enabled_) { |
| NOTREACHED(); |
| - return base::kInvalidPlatformFileValue; |
| + return base::File(); |
| } |
| - // mode==0 (read-only) is the only supported mode. |
| - // TODO(kinuko): Remove this parameter. |
| - DCHECK_EQ(0, mode); |
| - return base::CreatePlatformFile( |
| - base::FilePath::FromUTF16Unsafe(path), |
| - base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, |
| - NULL, NULL); |
| + return base::File(base::FilePath::FromUTF16Unsafe(path), |
| + base::File::FLAG_OPEN | base::File::FLAG_READ); |
| } |
| -void WebFileUtilitiesImpl::closeFile(base::PlatformFile& handle) { |
| - if (handle == base::kInvalidPlatformFileValue) |
| - return; |
| - if (base::ClosePlatformFile(handle)) |
| - handle = base::kInvalidPlatformFileValue; |
| -} |
| - |
| -int WebFileUtilitiesImpl::readFromFile(base::PlatformFile handle, |
| +int WebFileUtilitiesImpl::readFromFile(base::File* file, |
|
rvargas (doing something else)
2014/03/21 18:39:16
I would actually remove this method completely, as
|
| char* data, |
| int length) { |
| - if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) |
| + if (!file->IsValid() || !data || length <= 0) |
| return -1; |
| - return base::ReadPlatformFileCurPosNoBestEffort(handle, data, length); |
| + return file->ReadAtCurrentPosNoBestEffort(data, length); |
| } |
| } // namespace content |