OLD | NEW |
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/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 22 matching lines...) Expand all Loading... |
33 bool WebFileUtilitiesImpl::deleteFile(const WebString& path) { | 33 bool WebFileUtilitiesImpl::deleteFile(const WebString& path) { |
34 NOTREACHED(); | 34 NOTREACHED(); |
35 return false; | 35 return false; |
36 } | 36 } |
37 | 37 |
38 bool WebFileUtilitiesImpl::deleteEmptyDirectory(const WebString& path) { | 38 bool WebFileUtilitiesImpl::deleteEmptyDirectory(const WebString& path) { |
39 NOTREACHED(); | 39 NOTREACHED(); |
40 return false; | 40 return false; |
41 } | 41 } |
42 | 42 |
43 bool WebFileUtilitiesImpl::getFileSize(const WebString& path, | |
44 long long& result) { | |
45 if (sandbox_enabled_) { | |
46 NOTREACHED(); | |
47 return false; | |
48 } | |
49 return file_util::GetFileSize(WebStringToFilePath(path), | |
50 reinterpret_cast<int64*>(&result)); | |
51 } | |
52 | |
53 bool WebFileUtilitiesImpl::getFileModificationTime(const WebString& path, | |
54 double& result) { | |
55 if (sandbox_enabled_) { | |
56 NOTREACHED(); | |
57 return false; | |
58 } | |
59 base::PlatformFileInfo info; | |
60 if (!file_util::GetFileInfo(WebStringToFilePath(path), &info)) | |
61 return false; | |
62 result = info.last_modified.ToDoubleT(); | |
63 return true; | |
64 } | |
65 | |
66 bool WebFileUtilitiesImpl::getFileInfo(const WebString& path, | 43 bool WebFileUtilitiesImpl::getFileInfo(const WebString& path, |
67 WebKit::WebFileInfo& web_file_info) { | 44 WebKit::WebFileInfo& web_file_info) { |
68 if (sandbox_enabled_) { | 45 if (sandbox_enabled_) { |
69 NOTREACHED(); | 46 NOTREACHED(); |
70 return false; | 47 return false; |
71 } | 48 } |
72 base::PlatformFileInfo file_info; | 49 base::PlatformFileInfo file_info; |
73 if (!file_util::GetFileInfo(WebStringToFilePath(path), &file_info)) | 50 if (!file_util::GetFileInfo(WebStringToFilePath(path), &file_info)) |
74 return false; | 51 return false; |
75 | 52 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, | 142 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, |
166 const char* data, | 143 const char* data, |
167 int length) { | 144 int length) { |
168 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) | 145 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) |
169 return -1; | 146 return -1; |
170 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE, NULL); | 147 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE, NULL); |
171 return file_stream.WriteSync(data, length); | 148 return file_stream.WriteSync(data, length); |
172 } | 149 } |
173 | 150 |
174 } // namespace webkit_glue | 151 } // namespace webkit_glue |
OLD | NEW |