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

Unified Diff: base/file_util_posix.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util.h ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 77e080a7baa99d9f26e08e7ac378f724f5103884..afb34b434cbe8aae3f6f4260670e2aa41180ee0f 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -58,24 +58,8 @@
#include "base/chromeos/chromeos_version.h"
#endif
-using base::FileEnumerator;
-using base::FilePath;
-using base::MakeAbsoluteFilePath;
-
namespace base {
-FilePath MakeAbsoluteFilePath(const FilePath& input) {
- base::ThreadRestrictions::AssertIOAllowed();
- char full_path[PATH_MAX];
- if (realpath(input.value().c_str(), full_path) == NULL)
- return FilePath();
- return FilePath(full_path);
-}
-
-} // namespace base
-
-namespace file_util {
-
namespace {
#if defined(OS_BSD) || defined(OS_MACOSX)
@@ -152,16 +136,12 @@ bool VerifySpecificPathControlledByUser(const FilePath& path,
} // namespace
-static std::string TempFileName() {
-#if defined(OS_MACOSX)
- return base::StringPrintf(".%s.XXXXXX", base::mac::BaseBundleID());
-#endif
-
-#if defined(GOOGLE_CHROME_BUILD)
- return std::string(".com.google.Chrome.XXXXXX");
-#else
- return std::string(".org.chromium.Chromium.XXXXXX");
-#endif
+FilePath MakeAbsoluteFilePath(const FilePath& input) {
+ ThreadRestrictions::AssertIOAllowed();
+ char full_path[PATH_MAX];
+ if (realpath(input.value().c_str(), full_path) == NULL)
+ return FilePath();
+ return FilePath(full_path);
}
// TODO(erikkay): The Windows version of this accepts paths like "foo/bar/*"
@@ -169,7 +149,7 @@ static std::string TempFileName() {
// that functionality. If not, remove from file_util_win.cc, otherwise add it
// here.
bool Delete(const FilePath& path, bool recursive) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
const char* path_str = path.value().c_str();
stat_wrapper_t file_info;
int test = CallLstat(path_str, &file_info);
@@ -205,6 +185,33 @@ bool Delete(const FilePath& path, bool recursive) {
return success;
}
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
+using base::stat_wrapper_t;
+using base::CallStat;
+using base::CallLstat;
+using base::FileEnumerator;
+using base::FilePath;
+using base::MakeAbsoluteFilePath;
+using base::RealPath;
+using base::VerifySpecificPathControlledByUser;
+
+static std::string TempFileName() {
+#if defined(OS_MACOSX)
+ return base::StringPrintf(".%s.XXXXXX", base::mac::BaseBundleID());
+#endif
+
+#if defined(GOOGLE_CHROME_BUILD)
+ return std::string(".com.google.Chrome.XXXXXX");
+#else
+ return std::string(".org.chromium.Chromium.XXXXXX");
+#endif
+}
+
bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) {
base::ThreadRestrictions::AssertIOAllowed();
// Windows compatibility: if to_path exists, from_path and to_path
« no previous file with comments | « base/file_util.h ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698