diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-02 16:05:30 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-02 16:05:30 +0000 |
commit | 454cd7747db158a625e4d3ca2de2ef39a6aac801 (patch) | |
tree | ad127a9e94d86e39c51a0b30b887c2b0208b4145 /webkit | |
parent | 4c03784db6dca496004a7f547a5384291294aa24 (diff) | |
download | chromium_src-454cd7747db158a625e4d3ca2de2ef39a6aac801.zip chromium_src-454cd7747db158a625e4d3ca2de2ef39a6aac801.tar.gz chromium_src-454cd7747db158a625e4d3ca2de2ef39a6aac801.tar.bz2 |
Remove unnecessary FileUtilities methods (chrome side)
Blink side patch: https://codereview.chromium.org/21471003/
BUG=267341
TET=compile
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/21520003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webfileutilities_impl.cc | 64 | ||||
-rw-r--r-- | webkit/glue/webfileutilities_impl.h | 14 |
2 files changed, 4 insertions, 74 deletions
diff --git a/webkit/glue/webfileutilities_impl.cc b/webkit/glue/webfileutilities_impl.cc index 3ad3b3d..25829a0 100644 --- a/webkit/glue/webfileutilities_impl.cc +++ b/webkit/glue/webfileutilities_impl.cc @@ -25,20 +25,6 @@ WebFileUtilitiesImpl::WebFileUtilitiesImpl() WebFileUtilitiesImpl::~WebFileUtilitiesImpl() { } -bool WebFileUtilitiesImpl::fileExists(const WebString& path) { - return base::PathExists(base::FilePath::FromUTF16Unsafe(path)); -} - -bool WebFileUtilitiesImpl::deleteFile(const WebString& path) { - NOTREACHED(); - return false; -} - -bool WebFileUtilitiesImpl::deleteEmptyDirectory(const WebString& path) { - NOTREACHED(); - return false; -} - bool WebFileUtilitiesImpl::getFileInfo(const WebString& path, WebKit::WebFileInfo& web_file_info) { if (sandbox_enabled_) { @@ -59,24 +45,6 @@ WebString WebFileUtilitiesImpl::directoryName(const WebString& path) { return base::FilePath::FromUTF16Unsafe(path).DirName().AsUTF16Unsafe(); } -WebString WebFileUtilitiesImpl::pathByAppendingComponent( - const WebString& webkit_path, - const WebString& webkit_component) { - base::FilePath path(base::FilePath::FromUTF16Unsafe(webkit_path)); - base::FilePath component(base::FilePath::FromUTF16Unsafe(webkit_component)); - base::FilePath combined_path = path.Append(component); - return combined_path.AsUTF16Unsafe(); -} - -bool WebFileUtilitiesImpl::makeAllDirectories(const WebString& path) { - DCHECK(!sandbox_enabled_); - return file_util::CreateDirectory(base::FilePath::FromUTF16Unsafe(path)); -} - -bool WebFileUtilitiesImpl::isDirectory(const WebString& path) { - return base::DirectoryExists(base::FilePath::FromUTF16Unsafe(path)); -} - WebKit::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) { return net::FilePathToFileURL(base::FilePath::FromUTF16Unsafe(path)); } @@ -87,11 +55,12 @@ base::PlatformFile WebFileUtilitiesImpl::openFile(const WebString& path, NOTREACHED(); return base::kInvalidPlatformFileValue; } + // mode==0 (read-only) is the only supported mode. + // TODO(kinuko): Remove this parameter. + DCHECK_EQ(0, mode); return base::CreatePlatformFile( base::FilePath::FromUTF16Unsafe(path), - (mode == 0) ? (base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ) - : (base::PLATFORM_FILE_CREATE_ALWAYS | - base::PLATFORM_FILE_WRITE), + base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, NULL, NULL); } @@ -102,23 +71,6 @@ void WebFileUtilitiesImpl::closeFile(base::PlatformFile& handle) { handle = base::kInvalidPlatformFileValue; } -long long WebFileUtilitiesImpl::seekFile(base::PlatformFile handle, - long long offset, - int origin) { - if (handle == base::kInvalidPlatformFileValue) - return -1; - return base::SeekPlatformFile(handle, - static_cast<base::PlatformFileWhence>(origin), - offset); -} - -bool WebFileUtilitiesImpl::truncateFile(base::PlatformFile handle, - long long offset) { - if (handle == base::kInvalidPlatformFileValue || offset < 0) - return false; - return base::TruncatePlatformFile(handle, offset); -} - int WebFileUtilitiesImpl::readFromFile(base::PlatformFile handle, char* data, int length) { @@ -127,12 +79,4 @@ int WebFileUtilitiesImpl::readFromFile(base::PlatformFile handle, return base::ReadPlatformFileCurPosNoBestEffort(handle, data, length); } -int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, - const char* data, - int length) { - if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) - return -1; - return base::WritePlatformFileCurPosNoBestEffort(handle, data, length); -} - } // namespace webkit_glue diff --git a/webkit/glue/webfileutilities_impl.h b/webkit/glue/webfileutilities_impl.h index a3d2bb2..f7ed6ee 100644 --- a/webkit/glue/webfileutilities_impl.h +++ b/webkit/glue/webfileutilities_impl.h @@ -19,28 +19,14 @@ class WEBKIT_GLUE_EXPORT WebFileUtilitiesImpl : virtual ~WebFileUtilitiesImpl(); // WebFileUtilities methods: - virtual bool fileExists(const WebKit::WebString& path); - virtual bool deleteFile(const WebKit::WebString& path); - virtual bool deleteEmptyDirectory(const WebKit::WebString& path); virtual bool getFileInfo( const WebKit::WebString& path, WebKit::WebFileInfo& result); virtual WebKit::WebString directoryName(const WebKit::WebString& path); - virtual WebKit::WebString pathByAppendingComponent( - const WebKit::WebString& path, const WebKit::WebString& component); - virtual bool makeAllDirectories(const WebKit::WebString& path); - virtual bool isDirectory(const WebKit::WebString& path); virtual WebKit::WebURL filePathToURL(const WebKit::WebString& path); virtual base::PlatformFile openFile(const WebKit::WebString& path, int mode); virtual void closeFile(base::PlatformFile& handle); - virtual long long seekFile(base::PlatformFile handle, - long long offset, - int origin); - virtual bool truncateFile(base::PlatformFile handle, long long offset); virtual int readFromFile(base::PlatformFile handle, char* data, int length); - virtual int writeToFile(base::PlatformFile handle, - const char* data, - int length); void set_sandbox_enabled(bool sandbox_enabled) { sandbox_enabled_ = sandbox_enabled; |