| 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_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 base::FilePath combined_path = path.Append(component); | 67 base::FilePath combined_path = path.Append(component); |
| 68 return combined_path.AsUTF16Unsafe(); | 68 return combined_path.AsUTF16Unsafe(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool WebFileUtilitiesImpl::makeAllDirectories(const WebString& path) { | 71 bool WebFileUtilitiesImpl::makeAllDirectories(const WebString& path) { |
| 72 DCHECK(!sandbox_enabled_); | 72 DCHECK(!sandbox_enabled_); |
| 73 return file_util::CreateDirectory(base::FilePath::FromUTF16Unsafe(path)); | 73 return file_util::CreateDirectory(base::FilePath::FromUTF16Unsafe(path)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool WebFileUtilitiesImpl::isDirectory(const WebString& path) { | 76 bool WebFileUtilitiesImpl::isDirectory(const WebString& path) { |
| 77 return file_util::DirectoryExists(base::FilePath::FromUTF16Unsafe(path)); | 77 return base::DirectoryExists(base::FilePath::FromUTF16Unsafe(path)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 WebKit::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) { | 80 WebKit::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) { |
| 81 return net::FilePathToFileURL(base::FilePath::FromUTF16Unsafe(path)); | 81 return net::FilePathToFileURL(base::FilePath::FromUTF16Unsafe(path)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 base::PlatformFile WebFileUtilitiesImpl::openFile(const WebString& path, | 84 base::PlatformFile WebFileUtilitiesImpl::openFile(const WebString& path, |
| 85 int mode) { | 85 int mode) { |
| 86 if (sandbox_enabled_) { | 86 if (sandbox_enabled_) { |
| 87 NOTREACHED(); | 87 NOTREACHED(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, | 130 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, |
| 131 const char* data, | 131 const char* data, |
| 132 int length) { | 132 int length) { |
| 133 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) | 133 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) |
| 134 return -1; | 134 return -1; |
| 135 return base::WritePlatformFileCurPosNoBestEffort(handle, data, length); | 135 return base::WritePlatformFileCurPosNoBestEffort(handle, data, length); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace webkit_glue | 138 } // namespace webkit_glue |
| OLD | NEW |