| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/glue/webfileutilities_impl.h" | 5 #include "webkit/glue/webfileutilities_impl.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/base/file_stream.h" | 10 #include "net/base/file_stream.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return file_util::GetFileSize(WebStringToFilePath(path), | 48 return file_util::GetFileSize(WebStringToFilePath(path), |
| 49 reinterpret_cast<int64*>(&result)); | 49 reinterpret_cast<int64*>(&result)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool WebFileUtilitiesImpl::getFileModificationTime(const WebString& path, | 52 bool WebFileUtilitiesImpl::getFileModificationTime(const WebString& path, |
| 53 double& result) { | 53 double& result) { |
| 54 if (sandbox_enabled_) { | 54 if (sandbox_enabled_) { |
| 55 NOTREACHED(); | 55 NOTREACHED(); |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 file_util::FileInfo info; | 58 base::PlatformFileInfo info; |
| 59 if (!file_util::GetFileInfo(WebStringToFilePath(path), &info)) | 59 if (!file_util::GetFileInfo(WebStringToFilePath(path), &info)) |
| 60 return false; | 60 return false; |
| 61 result = info.last_modified.ToDoubleT(); | 61 result = info.last_modified.ToDoubleT(); |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 WebString WebFileUtilitiesImpl::directoryName(const WebString& path) { | 65 WebString WebFileUtilitiesImpl::directoryName(const WebString& path) { |
| 66 FilePath file_path(WebStringToFilePathString(path)); | 66 FilePath file_path(WebStringToFilePathString(path)); |
| 67 return FilePathToWebString(file_path.DirName()); | 67 return FilePathToWebString(file_path.DirName()); |
| 68 } | 68 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, | 149 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, |
| 150 const char* data, | 150 const char* data, |
| 151 int length) { | 151 int length) { |
| 152 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) | 152 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) |
| 153 return -1; | 153 return -1; |
| 154 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); | 154 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); |
| 155 return file_stream.Write(data, length, NULL); | 155 return file_stream.Write(data, length, NULL); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace webkit_glue | 158 } // namespace webkit_glue |
| OLD | NEW |