Make base compile with no "using base::FilePath".
For base .cc files not using the base namespace, I added a using since theses
files should be moved to the base namespace, and then explicit qualification
will no longer be necessary.
Original review URL: https://codereview.chromium.org/12226121
(reland of r182040).
Review URL: https://codereview.chromium.org/12278014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182916 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 04af979a6940c84bc315b3bf6c946824f0262614
diff --git a/base/command_line.cc b/base/command_line.cc
index b366165..1c73846 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -20,6 +20,8 @@
#include <shellapi.h>
#endif
+using base::FilePath;
+
CommandLine* CommandLine::current_process_commandline_ = NULL;
namespace {
diff --git a/base/file_path.cc b/base/file_path.cc
index fe2db15..d56d8d0 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -29,6 +29,8 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
+namespace base {
+
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
const FilePath::CharType FilePath::kSeparators[] = FILE_PATH_LITERAL("\\/");
#else // FILE_PATH_USES_WIN_SEPARATORS
@@ -404,7 +406,7 @@
return FilePath(ret);
}
-FilePath FilePath::InsertBeforeExtensionASCII(const base::StringPiece& suffix)
+FilePath FilePath::InsertBeforeExtensionASCII(const StringPiece& suffix)
const {
DCHECK(IsStringASCII(suffix));
#if defined(OS_WIN)
@@ -506,7 +508,7 @@
return Append(component.value());
}
-FilePath FilePath::AppendASCII(const base::StringPiece& component) const {
+FilePath FilePath::AppendASCII(const StringPiece& component) const {
DCHECK(IsStringASCII(component));
#if defined(OS_WIN)
return Append(ASCIIToUTF16(component.as_string()));
@@ -544,7 +546,7 @@
// platforms. These encoding conversion functions are not quite correct.
string16 FilePath::LossyDisplayName() const {
- return WideToUTF16(base::SysNativeMBToWide(path_));
+ return WideToUTF16(SysNativeMBToWide(path_));
}
std::string FilePath::MaybeAsASCII() const {
@@ -557,7 +559,7 @@
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
return value();
#else
- return WideToUTF8(base::SysNativeMBToWide(value()));
+ return WideToUTF8(SysNativeMBToWide(value()));
#endif
}
@@ -566,7 +568,7 @@
// static
FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
- return FilePath(base::SysWideToNativeMB(wstring));
+ return FilePath(SysWideToNativeMB(wstring));
}
// static
@@ -574,7 +576,7 @@
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
return FilePath(utf8);
#else
- return FilePath(base::SysWideToNativeMB(UTF8ToWide(utf8)));
+ return FilePath(SysWideToNativeMB(UTF8ToWide(utf8)));
#endif
}
@@ -1129,7 +1131,7 @@
}
StringType FilePath::GetHFSDecomposedForm(const StringType& string) {
- base::mac::ScopedCFTypeRef<CFStringRef> cfstring(
+ mac::ScopedCFTypeRef<CFStringRef> cfstring(
CFStringCreateWithBytesNoCopy(
NULL,
reinterpret_cast<const UInt8*>(string.c_str()),
@@ -1176,7 +1178,7 @@
// GetHFSDecomposedForm() returns an empty string in an error case.
if (hfs1.empty() || hfs2.empty()) {
NOTREACHED();
- base::mac::ScopedCFTypeRef<CFStringRef> cfstring1(
+ mac::ScopedCFTypeRef<CFStringRef> cfstring1(
CFStringCreateWithBytesNoCopy(
NULL,
reinterpret_cast<const UInt8*>(string1.c_str()),
@@ -1184,7 +1186,7 @@
kCFStringEncodingUTF8,
false,
kCFAllocatorNull));
- base::mac::ScopedCFTypeRef<CFStringRef> cfstring2(
+ mac::ScopedCFTypeRef<CFStringRef> cfstring2(
CFStringCreateWithBytesNoCopy(
NULL,
reinterpret_cast<const UInt8*>(string2.c_str()),
@@ -1251,6 +1253,8 @@
#endif
}
-void PrintTo(const FilePath& path, std::ostream* out) {
+} // namespace base
+
+void PrintTo(const base::FilePath& path, std::ostream* out) {
*out << path.value();
}
diff --git a/base/file_util.cc b/base/file_util.cc
index 07f2771..03e70f9 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -18,6 +18,8 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+using base::FilePath;
+
namespace {
const FilePath::CharType kExtensionSeparator = FILE_PATH_LITERAL('.');
diff --git a/base/file_util_linux.cc b/base/file_util_linux.cc
index f7d4f6e..cee2526 100644
--- a/base/file_util_linux.cc
+++ b/base/file_util_linux.cc
@@ -11,7 +11,7 @@
namespace file_util {
-bool GetFileSystemType(const FilePath& path, FileSystemType* type) {
+bool GetFileSystemType(const base::FilePath& path, FileSystemType* type) {
struct statfs statfs_buf;
if (statfs(path.value().c_str(), &statfs_buf) < 0) {
if (errno == ENOENT)
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 5bf4fb1..da7a096 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -58,6 +58,8 @@
#include "base/chromeos/chromeos_version.h"
#endif
+using base::FilePath;
+
namespace file_util {
namespace {
diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc
index 2fac451..5ee974b 100644
--- a/base/json/json_file_value_serializer.cc
+++ b/base/json/json_file_value_serializer.cc
@@ -8,6 +8,8 @@
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
+using base::FilePath;
+
const char* JSONFileValueSerializer::kAccessDenied = "Access denied.";
const char* JSONFileValueSerializer::kCannotReadFile = "Can't read file.";
const char* JSONFileValueSerializer::kFileLocked = "File locked.";
diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h
index 633db5d..3869e5e 100644
--- a/base/json/json_file_value_serializer.h
+++ b/base/json/json_file_value_serializer.h
@@ -18,7 +18,7 @@
// deserialization or the destination of the serialization.
// When deserializing, the file should exist, but when serializing, the
// serializer will attempt to create the file at the specified location.
- explicit JSONFileValueSerializer(const FilePath& json_file_path)
+ explicit JSONFileValueSerializer(const base::FilePath& json_file_path)
: json_file_path_(json_file_path),
allow_trailing_comma_(false) {}
@@ -74,7 +74,7 @@
private:
bool SerializeInternal(const Value& root, bool omit_binary_values);
- FilePath json_file_path_;
+ base::FilePath json_file_path_;
bool allow_trailing_comma_;
// A wrapper for file_util::ReadFileToString which returns a non-zero
diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc
index affc46d..00dcafa 100644
--- a/base/nix/mime_util_xdg.cc
+++ b/base/nix/mime_util_xdg.cc
@@ -23,6 +23,9 @@
#include "base/threading/thread_restrictions.h"
#include "base/time.h"
+namespace base {
+namespace nix {
+
namespace {
class IconTheme;
@@ -571,9 +574,6 @@
} // namespace
-namespace base {
-namespace nix {
-
std::string GetFileMimeType(const FilePath& filepath) {
if (filepath.empty())
return std::string();
diff --git a/base/path_service.cc b/base/path_service.cc
index a19e78d..cb34d28 100644
--- a/base/path_service.cc
+++ b/base/path_service.cc
@@ -17,6 +17,8 @@
#include "base/logging.h"
#include "base/synchronization/lock.h"
+using base::FilePath;
+
namespace base {
bool PathProvider(int key, FilePath* result);
#if defined(OS_WIN)