Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: webkit/glue/webfileutilities_impl.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return webkit_base::FilePathStringToWebString(combined_path.value()); 71 return webkit_base::FilePathStringToWebString(combined_path.value());
72 } 72 }
73 73
74 bool WebFileUtilitiesImpl::makeAllDirectories(const WebString& path) { 74 bool WebFileUtilitiesImpl::makeAllDirectories(const WebString& path) {
75 DCHECK(!sandbox_enabled_); 75 DCHECK(!sandbox_enabled_);
76 base::FilePath file_path = webkit_base::WebStringToFilePath(path); 76 base::FilePath file_path = webkit_base::WebStringToFilePath(path);
77 return file_util::CreateDirectory(file_path); 77 return file_util::CreateDirectory(file_path);
78 } 78 }
79 79
80 WebString WebFileUtilitiesImpl::getAbsolutePath(const WebString& path) { 80 WebString WebFileUtilitiesImpl::getAbsolutePath(const WebString& path) {
81 base::FilePath file_path(webkit_base::WebStringToFilePath(path)); 81 base::FilePath file_path(base::MakeAbsoluteFilePath(
82 file_util::AbsolutePath(&file_path); 82 webkit_base::WebStringToFilePath(path)));
83 return webkit_base::FilePathStringToWebString(file_path.value()); 83 return webkit_base::FilePathStringToWebString(file_path.value());
84 } 84 }
85 85
86 bool WebFileUtilitiesImpl::isDirectory(const WebString& path) { 86 bool WebFileUtilitiesImpl::isDirectory(const WebString& path) {
87 base::FilePath file_path(webkit_base::WebStringToFilePath(path)); 87 base::FilePath file_path(webkit_base::WebStringToFilePath(path));
88 return file_util::DirectoryExists(file_path); 88 return file_util::DirectoryExists(file_path);
89 } 89 }
90 90
91 WebKit::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) { 91 WebKit::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) {
92 return net::FilePathToFileURL(webkit_base::WebStringToFilePath(path)); 92 return net::FilePathToFileURL(webkit_base::WebStringToFilePath(path));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle, 141 int WebFileUtilitiesImpl::writeToFile(base::PlatformFile handle,
142 const char* data, 142 const char* data,
143 int length) { 143 int length) {
144 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0) 144 if (handle == base::kInvalidPlatformFileValue || !data || length <= 0)
145 return -1; 145 return -1;
146 return base::WritePlatformFileCurPosNoBestEffort(handle, data, length); 146 return base::WritePlatformFileCurPosNoBestEffort(handle, data, length);
147 } 147 }
148 148
149 } // namespace webkit_glue 149 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698