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/webfilesystem_impl.h" | 5 #include "webkit/glue/webfilesystem_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 return false; | 52 return false; |
53 } | 53 } |
54 file_util::FileInfo info; | 54 file_util::FileInfo info; |
55 if (!file_util::GetFileInfo(WebStringToFilePath(path), &info)) | 55 if (!file_util::GetFileInfo(WebStringToFilePath(path), &info)) |
56 return false; | 56 return false; |
57 result = info.last_modified.ToDoubleT(); | 57 result = info.last_modified.ToDoubleT(); |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 WebString WebFileSystemImpl::directoryName(const WebString& path) { | 61 WebString WebFileSystemImpl::directoryName(const WebString& path) { |
62 NOTREACHED(); | 62 FilePath file_path(WebStringToFilePathString(path)); |
63 return WebString(); | 63 return FilePathToWebString(file_path.DirName()); |
64 } | 64 } |
65 | 65 |
66 WebString WebFileSystemImpl::pathByAppendingComponent( | 66 WebString WebFileSystemImpl::pathByAppendingComponent( |
67 const WebString& webkit_path, | 67 const WebString& webkit_path, |
68 const WebString& webkit_component) { | 68 const WebString& webkit_component) { |
69 FilePath path(WebStringToFilePathString(webkit_path)); | 69 FilePath path(WebStringToFilePathString(webkit_path)); |
70 FilePath component(WebStringToFilePathString(webkit_component)); | 70 FilePath component(WebStringToFilePathString(webkit_component)); |
71 FilePath combined_path = path.Append(component); | 71 FilePath combined_path = path.Append(component); |
72 return FilePathStringToWebString(combined_path.value()); | 72 return FilePathStringToWebString(combined_path.value()); |
73 } | 73 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 int WebFileSystemImpl::writeToFile(base::PlatformFile handle, | 145 int WebFileSystemImpl::writeToFile(base::PlatformFile handle, |
146 const char* data, | 146 const char* data, |
147 int length) { | 147 int length) { |
148 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) | 148 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) |
149 return -1; | 149 return -1; |
150 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); | 150 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); |
151 return file_stream.Write(data, length, NULL); | 151 return file_stream.Write(data, length, NULL); |
152 } | 152 } |
153 | 153 |
154 } // namespace webkit_glue | 154 } // namespace webkit_glue |
OLD | NEW |