| 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" |
| 11 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
| 12 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 14 #include "webkit/glue/webkit_glue.h" | 14 #include "webkit/glue/webkit_glue.h" |
| 15 | 15 |
| 16 using WebKit::WebString; | 16 using WebKit::WebString; |
| 17 | 17 |
| 18 namespace webkit_glue { | 18 namespace webkit_glue { |
| 19 | 19 |
| 20 WebFileUtilitiesImpl::WebFileUtilitiesImpl() | 20 WebFileUtilitiesImpl::WebFileUtilitiesImpl() |
| 21 : sandbox_enabled_(true) { | 21 : sandbox_enabled_(true) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 WebFileUtilitiesImpl::~WebFileUtilitiesImpl() { |
| 25 } |
| 26 |
| 24 bool WebFileUtilitiesImpl::fileExists(const WebString& path) { | 27 bool WebFileUtilitiesImpl::fileExists(const WebString& path) { |
| 25 FilePath::StringType file_path = WebStringToFilePathString(path); | 28 FilePath::StringType file_path = WebStringToFilePathString(path); |
| 26 return file_util::PathExists(FilePath(file_path)); | 29 return file_util::PathExists(FilePath(file_path)); |
| 27 } | 30 } |
| 28 | 31 |
| 29 bool WebFileUtilitiesImpl::deleteFile(const WebString& path) { | 32 bool WebFileUtilitiesImpl::deleteFile(const WebString& path) { |
| 30 NOTREACHED(); | 33 NOTREACHED(); |
| 31 return false; | 34 return false; |
| 32 } | 35 } |
| 33 | 36 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, | 149 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, |
| 147 const char* data, | 150 const char* data, |
| 148 int length) { | 151 int length) { |
| 149 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) | 152 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) |
| 150 return -1; | 153 return -1; |
| 151 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); | 154 net::FileStream file_stream(handle, base::PLATFORM_FILE_WRITE); |
| 152 return file_stream.Write(data, length, NULL); | 155 return file_stream.Write(data, length, NULL); |
| 153 } | 156 } |
| 154 | 157 |
| 155 } // namespace webkit_glue | 158 } // namespace webkit_glue |
| OLD | NEW |