diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-08 20:40:15 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-08 20:40:15 +0000 |
commit | 6cdfd7f74ebadbe6fd2f557039b8b94242dd714e (patch) | |
tree | 39125d76f2a25515427dd53a81265d73bbb8ed18 /net/base | |
parent | 81aee95aa6bcb433e4bc26212ea3341edf839bdb (diff) | |
download | chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.zip chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.tar.gz chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.tar.bz2 |
Replace FilePath with base::FilePath in net.
Review URL: https://codereview.chromium.org/12218081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
36 files changed, 197 insertions, 190 deletions
diff --git a/net/base/cert_test_util.cc b/net/base/cert_test_util.cc index 74b4a95..d384abe 100644 --- a/net/base/cert_test_util.cc +++ b/net/base/cert_test_util.cc @@ -14,10 +14,10 @@ namespace net { CertificateList CreateCertificateListFromFile( - const FilePath& certs_dir, + const base::FilePath& certs_dir, const std::string& cert_file, int format) { - FilePath cert_path = certs_dir.AppendASCII(cert_file); + base::FilePath cert_path = certs_dir.AppendASCII(cert_file); std::string cert_data; if (!file_util::ReadFileToString(cert_path, &cert_data)) return CertificateList(); @@ -27,9 +27,9 @@ CertificateList CreateCertificateListFromFile( } scoped_refptr<X509Certificate> ImportCertFromFile( - const FilePath& certs_dir, + const base::FilePath& certs_dir, const std::string& cert_file) { - FilePath cert_path = certs_dir.AppendASCII(cert_file); + base::FilePath cert_path = certs_dir.AppendASCII(cert_file); std::string cert_data; if (!file_util::ReadFileToString(cert_path, &cert_data)) return NULL; diff --git a/net/base/cert_verify_proc_unittest.cc b/net/base/cert_verify_proc_unittest.cc index 9a03123f..9dae0b2 100644 --- a/net/base/cert_verify_proc_unittest.cc +++ b/net/base/cert_verify_proc_unittest.cc @@ -152,7 +152,7 @@ TEST_F(CertVerifyProcTest, PaypalNullCertParsing) { // pass if error == ERR_CERT_DATE_INVALID. TODO(wtc): generate test // certificates for this unit test. http://crbug.com/111742 TEST_F(CertVerifyProcTest, IntermediateCARequireExplicitPolicy) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "www_us_army_mil_cert.der"); @@ -197,7 +197,7 @@ TEST_F(CertVerifyProcTest, IntermediateCARequireExplicitPolicy) { // SEC_ERROR_REVOKED_CERTIFICATE. This indicates a lack of revocation // status, i.e. that the revocation check is failing for some reason. TEST_F(CertVerifyProcTest, DISABLED_GlobalSignR3EVTest) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "2029_globalsign_com_cert.pem"); @@ -227,7 +227,7 @@ TEST_F(CertVerifyProcTest, DISABLED_GlobalSignR3EVTest) { // Test that verifying an ECDSA certificate doesn't crash on XP. (See // crbug.com/144466). TEST_F(CertVerifyProcTest, ECDSA_RSA) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> cert = ImportCertFromFile(certs_dir, @@ -258,7 +258,7 @@ static bool IsWeakKeyType(const std::string& key_type) { } TEST_F(CertVerifyProcTest, RejectWeakKeys) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); typedef std::vector<std::string> Strings; Strings key_types; @@ -329,7 +329,7 @@ TEST_F(CertVerifyProcTest, RejectWeakKeys) { // pass if error == ERR_CERT_DATE_INVALID. TODO(rsleevi): generate test // certificates for this unit test. http://crbug.com/111730 TEST_F(CertVerifyProcTest, ExtraneousMD5RootCert) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "images_etrade_wallst_com.pem"); @@ -363,7 +363,7 @@ TEST_F(CertVerifyProcTest, ExtraneousMD5RootCert) { // Test for bug 94673. TEST_F(CertVerifyProcTest, GoogleDigiNotarTest) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "google_diginotar.pem"); @@ -402,7 +402,7 @@ TEST_F(CertVerifyProcTest, DigiNotarCerts) { NULL, }; - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); for (size_t i = 0; kDigiNotarFilenames[i]; i++) { scoped_refptr<X509Certificate> diginotar_cert = @@ -428,7 +428,7 @@ TEST_F(CertVerifyProcTest, DigiNotarCerts) { } TEST_F(CertVerifyProcTest, TestKnownRoot) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); CertificateList certs = CreateCertificateListFromFile( certs_dir, "certse.pem", X509Certificate::FORMAT_AUTO); ASSERT_EQ(3U, certs.size()); @@ -452,7 +452,7 @@ TEST_F(CertVerifyProcTest, TestKnownRoot) { } TEST_F(CertVerifyProcTest, PublicKeyHashes) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); CertificateList certs = CreateCertificateListFromFile( certs_dir, "certse.pem", X509Certificate::FORMAT_AUTO); ASSERT_EQ(3U, certs.size()); @@ -492,7 +492,7 @@ TEST_F(CertVerifyProcTest, PublicKeyHashes) { // The Key Usage extension in this RSA SSL server certificate does not have // the keyEncipherment bit. TEST_F(CertVerifyProcTest, InvalidKeyUsage) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "invalid_key_usage_cert.der"); @@ -526,7 +526,7 @@ TEST_F(CertVerifyProcTest, InvalidKeyUsage) { // used to ensure that the actual, verified chain is being returned by // Verify(). TEST_F(CertVerifyProcTest, VerifyReturnChainBasic) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); CertificateList certs = CreateCertificateListFromFile( certs_dir, "x509_verify_results.chain.pem", X509Certificate::FORMAT_AUTO); @@ -569,7 +569,7 @@ TEST_F(CertVerifyProcTest, VerifyReturnChainBasic) { // of intermediate certificates are combined, it's possible that order may // not be maintained. TEST_F(CertVerifyProcTest, VerifyReturnChainProperlyOrdered) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); CertificateList certs = CreateCertificateListFromFile( certs_dir, "x509_verify_results.chain.pem", X509Certificate::FORMAT_AUTO); @@ -610,7 +610,7 @@ TEST_F(CertVerifyProcTest, VerifyReturnChainProperlyOrdered) { // Test that Verify() filters out certificates which are not related to // or part of the certificate chain being verified. TEST_F(CertVerifyProcTest, VerifyReturnChainFiltersUnrelatedCerts) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); CertificateList certs = CreateCertificateListFromFile( certs_dir, "x509_verify_results.chain.pem", X509Certificate::FORMAT_AUTO); @@ -792,7 +792,7 @@ class CertVerifyProcWeakDigestTest TEST_P(CertVerifyProcWeakDigestTest, Verify) { WeakDigestTestData data = GetParam(); - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); ScopedTestRoot test_root; if (data.root_cert_filename) { diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc index f61b9e3..7bb3991 100644 --- a/net/base/directory_lister.cc +++ b/net/base/directory_lister.cc @@ -94,7 +94,7 @@ void SortData(std::vector<DirectoryLister::DirectoryListerData>* data, } // namespace -DirectoryLister::DirectoryLister(const FilePath& dir, +DirectoryLister::DirectoryLister(const base::FilePath& dir, DirectoryListerDelegate* delegate) : ALLOW_THIS_IN_INITIALIZER_LIST( core_(new Core(dir, false, ALPHA_DIRS_FIRST, this))), @@ -103,7 +103,7 @@ DirectoryLister::DirectoryLister(const FilePath& dir, DCHECK(!dir.value().empty()); } -DirectoryLister::DirectoryLister(const FilePath& dir, +DirectoryLister::DirectoryLister(const base::FilePath& dir, bool recursive, SortType sort, DirectoryListerDelegate* delegate) @@ -126,7 +126,7 @@ void DirectoryLister::Cancel() { return core_->Cancel(); } -DirectoryLister::Core::Core(const FilePath& dir, +DirectoryLister::Core::Core(const base::FilePath& dir, bool recursive, SortType sort, DirectoryLister* lister) @@ -166,7 +166,7 @@ void DirectoryLister::Core::StartInternal() { file_util::FileEnumerator file_enum(dir_, recursive_, types); - FilePath path; + base::FilePath path; std::vector<DirectoryListerData> file_data; while (lister_ && !(path = file_enum.Next()).empty()) { DirectoryListerData data; diff --git a/net/base/directory_lister.h b/net/base/directory_lister.h index 11976df..f1c5234 100644 --- a/net/base/directory_lister.h +++ b/net/base/directory_lister.h @@ -27,7 +27,7 @@ class NET_EXPORT DirectoryLister { // Represents one file found. struct DirectoryListerData { file_util::FileEnumerator::FindInfo info; - FilePath path; + base::FilePath path; }; // Implement this class to receive directory entries. @@ -55,10 +55,10 @@ class NET_EXPORT DirectoryLister { FULL_PATH }; - DirectoryLister(const FilePath& dir, + DirectoryLister(const base::FilePath& dir, DirectoryListerDelegate* delegate); - DirectoryLister(const FilePath& dir, + DirectoryLister(const base::FilePath& dir, bool recursive, SortType sort, DirectoryListerDelegate* delegate); @@ -76,7 +76,7 @@ class NET_EXPORT DirectoryLister { private: class Core : public base::RefCountedThreadSafe<Core> { public: - Core(const FilePath& dir, + Core(const base::FilePath& dir, bool recursive, SortType sort, DirectoryLister* lister); @@ -98,7 +98,7 @@ class NET_EXPORT DirectoryLister { void OnDone(int error); - FilePath dir_; + base::FilePath dir_; bool recursive_; SortType sort_; scoped_refptr<base::MessageLoopProxy> origin_loop_; diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc index 8759946..07d85ab 100644 --- a/net/base/directory_lister_unittest.cc +++ b/net/base/directory_lister_unittest.cc @@ -84,11 +84,11 @@ class ListerDelegate : public DirectoryLister::DirectoryListerDelegate { bool recursive_; bool quit_loop_after_each_file_; std::vector<file_util::FileEnumerator::FindInfo> file_list_; - std::vector<FilePath> paths_; + std::vector<base::FilePath> paths_; }; TEST(DirectoryListerTest, BigDirTest) { - FilePath path; + base::FilePath path; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &path)); ListerDelegate delegate(false, false); @@ -101,7 +101,7 @@ TEST(DirectoryListerTest, BigDirTest) { } TEST(DirectoryListerTest, BigDirRecursiveTest) { - FilePath path; + base::FilePath path; ASSERT_TRUE(PathService::Get(base::DIR_EXE, &path)); ListerDelegate delegate(true, false); @@ -114,7 +114,7 @@ TEST(DirectoryListerTest, BigDirRecursiveTest) { } TEST(DirectoryListerTest, CancelTest) { - FilePath path; + base::FilePath path; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &path)); ListerDelegate delegate(false, true); diff --git a/net/base/file_stream.cc b/net/base/file_stream.cc index 036fd19..aefdb69 100644 --- a/net/base/file_stream.cc +++ b/net/base/file_stream.cc @@ -43,7 +43,7 @@ FileStream::~FileStream() { bound_net_log_.EndEvent(NetLog::TYPE_FILE_STREAM_ALIVE); } -int FileStream::Open(const FilePath& path, int open_flags, +int FileStream::Open(const base::FilePath& path, int open_flags, const CompletionCallback& callback) { if (IsOpen()) { DLOG(FATAL) << "File is already open!"; @@ -56,7 +56,7 @@ int FileStream::Open(const FilePath& path, int open_flags, return ERR_IO_PENDING; } -int FileStream::OpenSync(const FilePath& path, int open_flags) { +int FileStream::OpenSync(const base::FilePath& path, int open_flags) { base::ThreadRestrictions::AssertIOAllowed(); if (IsOpen()) { diff --git a/net/base/file_stream_context.cc b/net/base/file_stream_context.cc index 1e0c157..53f3c3d 100644 --- a/net/base/file_stream_context.cc +++ b/net/base/file_stream_context.cc @@ -36,7 +36,7 @@ void FileStream::Context::Orphan() { } } -void FileStream::Context::OpenAsync(const FilePath& path, +void FileStream::Context::OpenAsync(const base::FilePath& path, int open_flags, const CompletionCallback& callback) { DCHECK(!async_in_progress_); @@ -55,7 +55,7 @@ void FileStream::Context::OpenAsync(const FilePath& path, async_in_progress_ = true; } -int FileStream::Context::OpenSync(const FilePath& path, int open_flags) { +int FileStream::Context::OpenSync(const base::FilePath& path, int open_flags) { DCHECK(!async_in_progress_); BeginOpenEvent(path); @@ -143,14 +143,14 @@ int FileStream::Context::RecordAndMapError(int error, return net_error; } -void FileStream::Context::BeginOpenEvent(const FilePath& path) { +void FileStream::Context::BeginOpenEvent(const base::FilePath& path) { std::string file_name = path.AsUTF8Unsafe(); bound_net_log_.BeginEvent(NetLog::TYPE_FILE_STREAM_OPEN, NetLog::StringCallback("file_name", &file_name)); } FileStream::Context::OpenResult FileStream::Context::OpenFileImpl( - const FilePath& path, int open_flags) { + const base::FilePath& path, int open_flags) { // FileStream::Context actually closes the file asynchronously, independently // from FileStream's destructor. It can cause problems for users wanting to // delete the file right after FileStream deletion. Thus we are always diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index 731de77..1757918 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -49,10 +49,10 @@ class FileStreamTest : public PlatformTest { PlatformTest::TearDown(); } - const FilePath temp_file_path() const { return temp_file_path_; } + const base::FilePath temp_file_path() const { return temp_file_path_; } private: - FilePath temp_file_path_; + base::FilePath temp_file_path_; }; namespace { diff --git a/net/base/filter.cc b/net/base/filter.cc index d633ca5..dbda8a6 100644 --- a/net/base/filter.cc +++ b/net/base/filter.cc @@ -178,8 +178,9 @@ void Filter::FixupEncodingTypes( GURL url; success = filter_context.GetURL(&url); DCHECK(success); - FilePath filename = FilePath().AppendASCII(url.ExtractFileName()); - FilePath::StringType extension = filename.Extension(); + base::FilePath filename = + base::FilePath().AppendASCII(url.ExtractFileName()); + base::FilePath::StringType extension = filename.Extension(); if (filter_context.IsDownload()) { // We don't want to decompress gzipped files when the user explicitly diff --git a/net/base/gzip_filter_unittest.cc b/net/base/gzip_filter_unittest.cc index c889143..be98bae 100644 --- a/net/base/gzip_filter_unittest.cc +++ b/net/base/gzip_filter_unittest.cc @@ -61,7 +61,7 @@ class GZipUnitTest : public PlatformTest { gzip_encode_buffer_ = NULL; // Get the path of source data file. - FilePath file_path; + base::FilePath file_path; PathService::Get(base::DIR_SOURCE_ROOT, &file_path); file_path = file_path.AppendASCII("net"); file_path = file_path.AppendASCII("data"); diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc index 0ad9ea6..27c3919 100644 --- a/net/base/mime_util.cc +++ b/net/base/mime_util.cc @@ -45,13 +45,13 @@ namespace net { // Singleton utility class for mime types. class MimeUtil : public PlatformMimeUtil { public: - bool GetMimeTypeFromExtension(const FilePath::StringType& ext, + bool GetMimeTypeFromExtension(const base::FilePath::StringType& ext, std::string* mime_type) const; - bool GetMimeTypeFromFile(const FilePath& file_path, + bool GetMimeTypeFromFile(const base::FilePath& file_path, std::string* mime_type) const; - bool GetWellKnownMimeTypeFromExtension(const FilePath::StringType& ext, + bool GetWellKnownMimeTypeFromExtension(const base::FilePath::StringType& ext, std::string* mime_type) const; bool IsSupportedImageMimeType(const std::string& mime_type) const; @@ -94,7 +94,7 @@ class MimeUtil : public PlatformMimeUtil { // For faster lookup, keep hash sets. void InitializeMimeTypeMaps(); - bool GetMimeTypeFromExtensionHelper(const FilePath::StringType& ext, + bool GetMimeTypeFromExtensionHelper(const base::FilePath::StringType& ext, bool include_platform_types, std::string* mime_type) const; @@ -184,28 +184,29 @@ static const char* FindMimeType(const MimeInfo* mappings, return NULL; } -bool MimeUtil::GetMimeTypeFromExtension(const FilePath::StringType& ext, +bool MimeUtil::GetMimeTypeFromExtension(const base::FilePath::StringType& ext, string* result) const { return GetMimeTypeFromExtensionHelper(ext, true, result); } bool MimeUtil::GetWellKnownMimeTypeFromExtension( - const FilePath::StringType& ext, + const base::FilePath::StringType& ext, string* result) const { return GetMimeTypeFromExtensionHelper(ext, false, result); } -bool MimeUtil::GetMimeTypeFromFile(const FilePath& file_path, +bool MimeUtil::GetMimeTypeFromFile(const base::FilePath& file_path, string* result) const { - FilePath::StringType file_name_str = file_path.Extension(); + base::FilePath::StringType file_name_str = file_path.Extension(); if (file_name_str.empty()) return false; return GetMimeTypeFromExtension(file_name_str.substr(1), result); } -bool MimeUtil::GetMimeTypeFromExtensionHelper(const FilePath::StringType& ext, - bool include_platform_types, - string* result) const { +bool MimeUtil::GetMimeTypeFromExtensionHelper( + const base::FilePath::StringType& ext, + bool include_platform_types, + string* result) const { // Avoids crash when unable to handle a long file path. See crbug.com/48733. const unsigned kMaxFilePathSize = 65536; if (ext.length() > kMaxFilePathSize) @@ -677,22 +678,23 @@ bool MimeUtil::IsSupportedStrictMediaMimeType( // Wrappers for the singleton //---------------------------------------------------------------------------- -bool GetMimeTypeFromExtension(const FilePath::StringType& ext, +bool GetMimeTypeFromExtension(const base::FilePath::StringType& ext, std::string* mime_type) { return g_mime_util.Get().GetMimeTypeFromExtension(ext, mime_type); } -bool GetMimeTypeFromFile(const FilePath& file_path, std::string* mime_type) { +bool GetMimeTypeFromFile(const base::FilePath& file_path, + std::string* mime_type) { return g_mime_util.Get().GetMimeTypeFromFile(file_path, mime_type); } -bool GetWellKnownMimeTypeFromExtension(const FilePath::StringType& ext, +bool GetWellKnownMimeTypeFromExtension(const base::FilePath::StringType& ext, std::string* mime_type) { return g_mime_util.Get().GetWellKnownMimeTypeFromExtension(ext, mime_type); } bool GetPreferredExtensionForMimeType(const std::string& mime_type, - FilePath::StringType* extension) { + base::FilePath::StringType* extension) { return g_mime_util.Get().GetPreferredExtensionForMimeType(mime_type, extension); } @@ -829,8 +831,8 @@ void GetExtensionsFromHardCodedMappings( const MimeInfo* mappings, size_t mappings_len, const std::string& leading_mime_type, - base::hash_set<FilePath::StringType>* extensions) { - FilePath::StringType extension; + base::hash_set<base::FilePath::StringType>* extensions) { + base::FilePath::StringType extension; for (size_t i = 0; i < mappings_len; ++i) { if (StartsWithASCII(mappings[i].mime_type, leading_mime_type, false)) { std::vector<string> this_extensions; @@ -838,9 +840,9 @@ void GetExtensionsFromHardCodedMappings( &this_extensions); for (size_t j = 0; j < this_extensions.size(); ++j) { #if defined(OS_WIN) - FilePath::StringType extension(UTF8ToWide(this_extensions[j])); + base::FilePath::StringType extension(UTF8ToWide(this_extensions[j])); #else - FilePath::StringType extension(this_extensions[j]); + base::FilePath::StringType extension(this_extensions[j]); #endif extensions->insert(extension); } @@ -848,10 +850,11 @@ void GetExtensionsFromHardCodedMappings( } } -void GetExtensionsHelper(const char* const* standard_types, - size_t standard_types_len, - const std::string& leading_mime_type, - base::hash_set<FilePath::StringType>* extensions) { +void GetExtensionsHelper( + const char* const* standard_types, + size_t standard_types_len, + const std::string& leading_mime_type, + base::hash_set<base::FilePath::StringType>* extensions) { for (size_t i = 0; i < standard_types_len; ++i) { g_mime_util.Get().GetPlatformExtensionsForMimeType(standard_types[i], extensions); @@ -883,13 +886,14 @@ void HashSetToVector(base::hash_set<T>* source, std::vector<T>* target) { } } -void GetExtensionsForMimeType(const std::string& unsafe_mime_type, - std::vector<FilePath::StringType>* extensions) { +void GetExtensionsForMimeType( + const std::string& unsafe_mime_type, + std::vector<base::FilePath::StringType>* extensions) { if (unsafe_mime_type == "*/*" || unsafe_mime_type == "*") return; const std::string mime_type = StringToLowerASCII(unsafe_mime_type); - base::hash_set<FilePath::StringType> unique_extensions; + base::hash_set<base::FilePath::StringType> unique_extensions; if (EndsWith(mime_type, "/*", true)) { std::string leading_mime_type = mime_type.substr(0, mime_type.length() - 1); diff --git a/net/base/mime_util.h b/net/base/mime_util.h index 45990d3..96d638a 100644 --- a/net/base/mime_util.h +++ b/net/base/mime_util.h @@ -15,7 +15,7 @@ namespace net { // Get the mime type (if any) that is associated with the given file extension. // Returns true if a corresponding mime type exists. -NET_EXPORT bool GetMimeTypeFromExtension(const FilePath::StringType& ext, +NET_EXPORT bool GetMimeTypeFromExtension(const base::FilePath::StringType& ext, std::string* mime_type); // Get the mime type (if any) that is associated with the given file extension. @@ -23,12 +23,12 @@ NET_EXPORT bool GetMimeTypeFromExtension(const FilePath::StringType& ext, // the search for a mime type is constrained to a limited set of // types known to the net library, the OS/registry is not consulted. NET_EXPORT bool GetWellKnownMimeTypeFromExtension( - const FilePath::StringType& ext, + const base::FilePath::StringType& ext, std::string* mime_type); // Get the mime type (if any) that is associated with the given file. Returns // true if a corresponding mime type exists. -NET_EXPORT bool GetMimeTypeFromFile(const FilePath& file_path, +NET_EXPORT bool GetMimeTypeFromFile(const base::FilePath& file_path, std::string* mime_type); // Get the preferred extension (if any) associated with the given mime type. @@ -36,7 +36,7 @@ NET_EXPORT bool GetMimeTypeFromFile(const FilePath& file_path, // returned without a prefixed dot, ex "html". NET_EXPORT bool GetPreferredExtensionForMimeType( const std::string& mime_type, - FilePath::StringType* extension); + base::FilePath::StringType* extension); // Check to see if a particular MIME type is in our list. NET_EXPORT bool IsSupportedImageMimeType(const std::string& mime_type); @@ -92,7 +92,7 @@ NET_EXPORT bool IsSupportedStrictMediaMimeType( // Instead, we append the result to it. NET_EXPORT void GetExtensionsForMimeType( const std::string& mime_type, - std::vector<FilePath::StringType>* extensions); + std::vector<base::FilePath::StringType>* extensions); // Test only methods that return lists of proprietary media types and codecs // that are not supported by all variations of Chromium. diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc index be4d7ca..38445f0 100644 --- a/net/base/mime_util_unittest.cc +++ b/net/base/mime_util_unittest.cc @@ -12,7 +12,7 @@ namespace net { TEST(MimeUtilTest, ExtensionTest) { const struct { - const FilePath::CharType* extension; + const base::FilePath::CharType* extension; const char* mime_type; bool valid; } tests[] = { @@ -36,7 +36,7 @@ TEST(MimeUtilTest, ExtensionTest) { TEST(MimeUtilTest, FileTest) { const struct { - const FilePath::CharType* file_path; + const base::FilePath::CharType* file_path; const char* mime_type; bool valid; } tests[] = { @@ -52,7 +52,7 @@ TEST(MimeUtilTest, FileTest) { bool rv; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { - rv = GetMimeTypeFromFile(FilePath(tests[i].file_path), + rv = GetMimeTypeFromFile(base::FilePath(tests[i].file_path), &mime_type); EXPECT_EQ(tests[i].valid, rv); if (rv) @@ -255,7 +255,7 @@ TEST(MimeUtilTest, TestGetExtensionsForMimeType) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { - std::vector<FilePath::StringType> extensions; + std::vector<base::FilePath::StringType> extensions; GetExtensionsForMimeType(tests[i].mime_type, &extensions); ASSERT_TRUE(tests[i].min_expected_size <= extensions.size()); diff --git a/net/base/mock_file_stream.cc b/net/base/mock_file_stream.cc index fccb7a0..d160f0c 100644 --- a/net/base/mock_file_stream.cc +++ b/net/base/mock_file_stream.cc @@ -8,7 +8,7 @@ namespace net { namespace testing { -int MockFileStream::OpenSync(const FilePath& path, int open_flags) { +int MockFileStream::OpenSync(const base::FilePath& path, int open_flags) { path_ = path; return ReturnError(FileStream::OpenSync(path, open_flags)); } diff --git a/net/base/mock_file_stream.h b/net/base/mock_file_stream.h index f9c8bbd..1509b50 100644 --- a/net/base/mock_file_stream.h +++ b/net/base/mock_file_stream.h @@ -28,7 +28,7 @@ class MockFileStream : public net::FileStream { : net::FileStream(file, flags, net_log), forced_error_(net::OK) {} // FileStream methods. - virtual int OpenSync(const FilePath& path, int open_flags) OVERRIDE; + virtual int OpenSync(const base::FilePath& path, int open_flags) OVERRIDE; virtual int Seek(net::Whence whence, int64 offset, const Int64CompletionCallback& callback) OVERRIDE; virtual int64 SeekSync(net::Whence whence, int64 offset) OVERRIDE; @@ -49,7 +49,7 @@ class MockFileStream : public net::FileStream { void set_forced_error(int error) { forced_error_ = error; } void clear_forced_error() { forced_error_ = net::OK; } int forced_error() const { return forced_error_; } - const FilePath& get_path() const { return path_; } + const base::FilePath& get_path() const { return path_; } private: int ReturnError(int function_error) { @@ -73,7 +73,7 @@ class MockFileStream : public net::FileStream { } int forced_error_; - FilePath path_; + base::FilePath path_; }; } // namespace testing diff --git a/net/base/multi_threaded_cert_verifier_unittest.cc b/net/base/multi_threaded_cert_verifier_unittest.cc index 6b0570c..f9bab0a 100644 --- a/net/base/multi_threaded_cert_verifier_unittest.cc +++ b/net/base/multi_threaded_cert_verifier_unittest.cc @@ -58,7 +58,7 @@ class MultiThreadedCertVerifierTest : public ::testing::Test { }; TEST_F(MultiThreadedCertVerifierTest, CacheHit) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> test_cert( ImportCertFromFile(certs_dir, "ok_cert.pem")); ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); @@ -97,7 +97,7 @@ TEST_F(MultiThreadedCertVerifierTest, CacheHit) { // certificates. These should be treated as different certificate chains even // though the two X509Certificate objects contain the same server certificate. TEST_F(MultiThreadedCertVerifierTest, DifferentCACerts) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "salesforce_com_test.pem"); @@ -155,7 +155,7 @@ TEST_F(MultiThreadedCertVerifierTest, DifferentCACerts) { // Tests an inflight join. TEST_F(MultiThreadedCertVerifierTest, InflightJoin) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> test_cert( ImportCertFromFile(certs_dir, "ok_cert.pem")); ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); @@ -189,7 +189,7 @@ TEST_F(MultiThreadedCertVerifierTest, InflightJoin) { // Tests that the callback of a canceled request is never made. TEST_F(MultiThreadedCertVerifierTest, CancelRequest) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> test_cert( ImportCertFromFile(certs_dir, "ok_cert.pem")); ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); @@ -222,7 +222,7 @@ TEST_F(MultiThreadedCertVerifierTest, CancelRequest) { // Tests that a canceled request is not leaked. TEST_F(MultiThreadedCertVerifierTest, CancelRequestThenQuit) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> test_cert( ImportCertFromFile(certs_dir, "ok_cert.pem")); ASSERT_NE(static_cast<X509Certificate*>(NULL), test_cert); diff --git a/net/base/net_util.cc b/net/base/net_util.cc index cd1df3e..ce1f786 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -83,7 +83,7 @@ namespace net { namespace { // what we prepend to get a file URL -static const FilePath::CharType kFileURLPrefix[] = +static const base::FilePath::CharType kFileURLPrefix[] = FILE_PATH_LITERAL("file:///"); // The general list of blocked ports. Will be blocked unless a specific @@ -852,15 +852,15 @@ bool IsReservedName(const string16& filename) { // integrating with the user's shell. void EnsureSafeExtension(const std::string& mime_type, bool ignore_extension, - FilePath* file_name) { + base::FilePath* file_name) { // See if our file name already contains an extension. - FilePath::StringType extension = file_name->Extension(); + base::FilePath::StringType extension = file_name->Extension(); if (!extension.empty()) extension.erase(extension.begin()); // Erase preceding '.'. if ((ignore_extension || extension.empty()) && !mime_type.empty()) { - FilePath::StringType preferred_mime_extension; - std::vector<FilePath::StringType> all_mime_extensions; + base::FilePath::StringType preferred_mime_extension; + std::vector<base::FilePath::StringType> all_mime_extensions; // The GetPreferredExtensionForMimeType call will end up going to disk. Do // this on another thread to avoid slowing the IO thread. // http://crbug.com/61827 @@ -882,7 +882,7 @@ void EnsureSafeExtension(const std::string& mime_type, } #if defined(OS_WIN) - static const FilePath::CharType default_extension[] = + static const base::FilePath::CharType default_extension[] = FILE_PATH_LITERAL("download"); // Rename shell-integrated extensions. @@ -911,11 +911,11 @@ size_t GetCountOfExplicitlyAllowedPorts() { return g_explicitly_allowed_ports.Get().size(); } -GURL FilePathToFileURL(const FilePath& path) { +GURL FilePathToFileURL(const base::FilePath& path) { // Produce a URL like "file:///C:/foo" for a regular file, or // "file://///server/path" for UNC. The URL canonicalizer will fix up the // latter case to be the canonical UNC form: "file://server/path" - FilePath::StringType url_string(kFileURLPrefix); + base::FilePath::StringType url_string(kFileURLPrefix); url_string.append(path.value()); // Now do replacement of some characters. Since we assume the input is a @@ -1120,19 +1120,19 @@ string16 StripWWWFromHost(const GURL& url) { void GenerateSafeFileName(const std::string& mime_type, bool ignore_extension, - FilePath* file_path) { + base::FilePath* file_path) { // Make sure we get the right file extension EnsureSafeExtension(mime_type, ignore_extension, file_path); #if defined(OS_WIN) // Prepend "_" to the file name if it's a reserved name - FilePath::StringType leaf_name = file_path->BaseName().value(); + base::FilePath::StringType leaf_name = file_path->BaseName().value(); DCHECK(!leaf_name.empty()); if (IsReservedName(leaf_name)) { - leaf_name = FilePath::StringType(FILE_PATH_LITERAL("_")) + leaf_name; + leaf_name = base::FilePath::StringType(FILE_PATH_LITERAL("_")) + leaf_name; *file_path = file_path->DirName(); - if (file_path->value() == FilePath::kCurrentDirectory) { - *file_path = FilePath(leaf_name); + if (file_path->value() == base::FilePath::kCurrentDirectory) { + *file_path = base::FilePath(leaf_name); } else { *file_path = file_path->Append(leaf_name); } @@ -1207,24 +1207,24 @@ string16 GetSuggestedFilename(const GURL& url, trimmed_trailing_character_count += path_length_before_trim - path.length(); file_util::ReplaceIllegalCharactersInPath(&path, '-'); path.append(trimmed_trailing_character_count, '-'); - FilePath result(path); + base::FilePath result(path); GenerateSafeFileName(mime_type, overwrite_extension, &result); return result.value(); #else std::string path = filename.empty() ? default_name : filename; file_util::ReplaceIllegalCharactersInPath(&path, '-'); - FilePath result(path); + base::FilePath result(path); GenerateSafeFileName(mime_type, overwrite_extension, &result); return UTF8ToUTF16(result.value()); #endif } -FilePath GenerateFileName(const GURL& url, - const std::string& content_disposition, - const std::string& referrer_charset, - const std::string& suggested_name, - const std::string& mime_type, - const std::string& default_file_name) { +base::FilePath GenerateFileName(const GURL& url, + const std::string& content_disposition, + const std::string& referrer_charset, + const std::string& suggested_name, + const std::string& mime_type, + const std::string& default_file_name) { string16 file_name = GetSuggestedFilename(url, content_disposition, referrer_charset, @@ -1233,9 +1233,10 @@ FilePath GenerateFileName(const GURL& url, default_file_name); #if defined(OS_WIN) - FilePath generated_name(file_name); + base::FilePath generated_name(file_name); #else - FilePath generated_name(base::SysWideToNativeMB(UTF16ToWide(file_name))); + base::FilePath generated_name( + base::SysWideToNativeMB(UTF16ToWide(file_name))); #endif #if defined(OS_CHROMEOS) diff --git a/net/base/net_util_posix.cc b/net/base/net_util_posix.cc index f66ae97..0bc0de6 100644 --- a/net/base/net_util_posix.cc +++ b/net/base/net_util_posix.cc @@ -29,8 +29,8 @@ namespace net { -bool FileURLToFilePath(const GURL& url, FilePath* path) { - *path = FilePath(); +bool FileURLToFilePath(const GURL& url, base::FilePath* path) { + *path = base::FilePath(); std::string& file_path_str = const_cast<std::string&>(path->value()); file_path_str.clear(); diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc index e4e181b..0945b2c 100644 --- a/net/base/net_util_unittest.cc +++ b/net/base/net_util_unittest.cc @@ -488,7 +488,7 @@ void RunGenerateFileNameTestCase(const GenerateFilenameCase* test_case, size_t iteration, const char* suite) { std::string default_filename(WideToUTF8(test_case->default_filename)); - FilePath file_path = GenerateFileName( + base::FilePath file_path = GenerateFileName( GURL(test_case->url), test_case->content_disp_header, test_case->referrer_charset, test_case->suggested_filename, test_case->mime_type, default_filename); @@ -539,7 +539,7 @@ TEST(NetUtilTest, FileURLConversion) { }; // First, we'll test that we can round-trip all of the above cases of URLs - FilePath output; + base::FilePath output; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(round_trip_cases); i++) { // convert to the file URL GURL file_url(FilePathToFileURL( @@ -818,8 +818,8 @@ TEST(NetUtilTest, StripWWW) { TEST(NetUtilTest, GenerateSafeFileName) { const struct { const char* mime_type; - const FilePath::CharType* filename; - const FilePath::CharType* expected_filename; + const base::FilePath::CharType* filename; + const base::FilePath::CharType* expected_filename; } safe_tests[] = { #if defined(OS_WIN) { @@ -964,7 +964,7 @@ TEST(NetUtilTest, GenerateSafeFileName) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(safe_tests); ++i) { - FilePath file_path(safe_tests[i].filename); + base::FilePath file_path(safe_tests[i].filename); GenerateSafeFileName(safe_tests[i].mime_type, false, &file_path); EXPECT_EQ(safe_tests[i].expected_filename, file_path.value()) << "Iteration " << i; diff --git a/net/base/net_util_win.cc b/net/base/net_util_win.cc index 5debd72..5b101ae 100644 --- a/net/base/net_util_win.cc +++ b/net/base/net_util_win.cc @@ -22,8 +22,8 @@ namespace net { -bool FileURLToFilePath(const GURL& url, FilePath* file_path) { - *file_path = FilePath(); +bool FileURLToFilePath(const GURL& url, base::FilePath* file_path) { + *file_path = base::FilePath(); std::wstring& file_path_str = const_cast<std::wstring&>(file_path->value()); file_path_str.clear(); diff --git a/net/base/nss_cert_database_unittest.cc b/net/base/nss_cert_database_unittest.cc index c88962d..b5e20b81 100644 --- a/net/base/nss_cert_database_unittest.cc +++ b/net/base/nss_cert_database_unittest.cc @@ -67,7 +67,7 @@ class CertDatabaseNSSTest : public testing::Test { protected: static std::string ReadTestFile(const std::string& name) { std::string result; - FilePath cert_path = GetTestCertsDirectory().AppendASCII(name); + base::FilePath cert_path = GetTestCertsDirectory().AppendASCII(name); EXPECT_TRUE(file_util::ReadFileToString(cert_path, &result)); return result; } diff --git a/net/base/platform_mime_util.h b/net/base/platform_mime_util.h index 85ee6cc..2cd4e2d 100644 --- a/net/base/platform_mime_util.h +++ b/net/base/platform_mime_util.h @@ -16,20 +16,21 @@ namespace net { class PlatformMimeUtil { public: // See documentation for base::GetPreferredExtensionForMimeType [mime_util.h] - bool GetPreferredExtensionForMimeType(const std::string& mime_type, - FilePath::StringType* extension) const; + bool GetPreferredExtensionForMimeType( + const std::string& mime_type, + base::FilePath::StringType* extension) const; // Adds all the extensions that the platform associates with the type // |mime_type| to the set |extensions|. Returns at least the value returned // by GetPreferredExtensionForMimeType. void GetPlatformExtensionsForMimeType( const std::string& mime_type, - base::hash_set<FilePath::StringType>* extensions) const; + base::hash_set<base::FilePath::StringType>* extensions) const; protected: // Get the mime type (if any) that is associated with the file extension. // Returns true if a corresponding mime type exists. - bool GetPlatformMimeTypeFromExtension(const FilePath::StringType& ext, + bool GetPlatformMimeTypeFromExtension(const base::FilePath::StringType& ext, std::string* mime_type) const; }; diff --git a/net/base/platform_mime_util_linux.cc b/net/base/platform_mime_util_linux.cc index 145f218..f4099e4 100644 --- a/net/base/platform_mime_util_linux.cc +++ b/net/base/platform_mime_util_linux.cc @@ -19,12 +19,12 @@ namespace net { #if defined(OS_ANDROID) bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( - const FilePath::StringType& ext, std::string* result) const { + const base::FilePath::StringType& ext, std::string* result) const { return android::GetMimeTypeFromExtension(ext, result); } #else bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( - const FilePath::StringType& ext, std::string* result) const { + const base::FilePath::StringType& ext, std::string* result) const { // TODO(thestig): This is a temporary hack until we can fix this // properly in test shell / webkit. // We have to play dumb and not return application/x-perl here @@ -32,7 +32,7 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( if (ext == "pl") return false; - FilePath dummy_path("foo." + ext); + base::FilePath dummy_path("foo." + ext); std::string out = base::nix::GetFileMimeType(dummy_path); // GetFileMimeType likes to return application/octet-stream @@ -74,7 +74,7 @@ const struct MimeToExt mime_type_ext_map[] = { }; bool PlatformMimeUtil::GetPreferredExtensionForMimeType( - const std::string& mime_type, FilePath::StringType* ext) const { + const std::string& mime_type, base::FilePath::StringType* ext) const { for (size_t x = 0; x < (sizeof(mime_type_ext_map) / sizeof(MimeToExt)); @@ -100,8 +100,8 @@ bool PlatformMimeUtil::GetPreferredExtensionForMimeType( void PlatformMimeUtil::GetPlatformExtensionsForMimeType( const std::string& mime_type, - base::hash_set<FilePath::StringType>* extensions) const { - FilePath::StringType ext; + base::hash_set<base::FilePath::StringType>* extensions) const { + base::FilePath::StringType ext; if (GetPreferredExtensionForMimeType(mime_type, &ext)) extensions->insert(ext); } diff --git a/net/base/platform_mime_util_mac.mm b/net/base/platform_mime_util_mac.mm index a431a36..ca85a8e 100644 --- a/net/base/platform_mime_util_mac.mm +++ b/net/base/platform_mime_util_mac.mm @@ -32,7 +32,7 @@ namespace net { bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( - const FilePath::StringType& ext, std::string* result) const { + const base::FilePath::StringType& ext, std::string* result) const { std::string ext_nodot = ext; if (ext_nodot.length() >= 1 && ext_nodot[0] == L'.') ext_nodot.erase(ext_nodot.begin()); @@ -56,7 +56,7 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( } bool PlatformMimeUtil::GetPreferredExtensionForMimeType( - const std::string& mime_type, FilePath::StringType* ext) const { + const std::string& mime_type, base::FilePath::StringType* ext) const { base::mac::ScopedCFTypeRef<CFStringRef> mime_ref( base::SysUTF8ToCFStringRef(mime_type)); if (!mime_ref) @@ -78,7 +78,7 @@ bool PlatformMimeUtil::GetPreferredExtensionForMimeType( void PlatformMimeUtil::GetPlatformExtensionsForMimeType( const std::string& mime_type, - base::hash_set<FilePath::StringType>* extensions) const { + base::hash_set<base::FilePath::StringType>* extensions) const { #if defined(OS_IOS) NSArray* extensions_list = nil; #else @@ -101,7 +101,7 @@ void PlatformMimeUtil::GetPlatformExtensionsForMimeType( extensions->insert(base::SysNSStringToUTF8(extension)); } else { // Huh? Give up. - FilePath::StringType ext; + base::FilePath::StringType ext; if (GetPreferredExtensionForMimeType(mime_type, &ext)) extensions->insert(ext); } diff --git a/net/base/platform_mime_util_win.cc b/net/base/platform_mime_util_win.cc index 7b65965..901a4d3 100644 --- a/net/base/platform_mime_util_win.cc +++ b/net/base/platform_mime_util_win.cc @@ -12,7 +12,7 @@ namespace net { bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( - const FilePath::StringType& ext, std::string* result) const { + const base::FilePath::StringType& ext, std::string* result) const { // check windows registry for file extension's mime type (registry key // names are not case-sensitive). std::wstring value, key = L"." + ext; @@ -26,7 +26,7 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( } bool PlatformMimeUtil::GetPreferredExtensionForMimeType( - const std::string& mime_type, FilePath::StringType* ext) const { + const std::string& mime_type, base::FilePath::StringType* ext) const { std::wstring key(L"MIME\\Database\\Content Type\\" + UTF8ToWide(mime_type)); if (base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue( L"Extension", ext) != ERROR_SUCCESS) { @@ -41,12 +41,12 @@ bool PlatformMimeUtil::GetPreferredExtensionForMimeType( void PlatformMimeUtil::GetPlatformExtensionsForMimeType( const std::string& mime_type, - base::hash_set<FilePath::StringType>* extensions) const { + base::hash_set<base::FilePath::StringType>* extensions) const { // Multiple extensions could have the given mime type specified as their types // in their 'HKCR\.<extension>\Content Type' keys. Iterating all the HKCR // entries, though, is wildly impractical. Cheat by returning just the // preferred extension. - FilePath::StringType ext; + base::FilePath::StringType ext; if (GetPreferredExtensionForMimeType(mime_type, &ext)) extensions->insert(ext); } diff --git a/net/base/test_data_directory.cc b/net/base/test_data_directory.cc index 3398fc0..df30c4f 100644 --- a/net/base/test_data_directory.cc +++ b/net/base/test_data_directory.cc @@ -10,22 +10,22 @@ namespace net { namespace { -const FilePath::CharType kCertificateRelativePath[] = +const base::FilePath::CharType kCertificateRelativePath[] = FILE_PATH_LITERAL("net/data/ssl/certificates"); } // namespace -FilePath GetTestCertsDirectory() { - FilePath src_root; +base::FilePath GetTestCertsDirectory() { + base::FilePath src_root; PathService::Get(base::DIR_SOURCE_ROOT, &src_root); return src_root.Append(kCertificateRelativePath); } -FilePath GetTestCertsDirectoryRelative() { - return FilePath(kCertificateRelativePath); +base::FilePath GetTestCertsDirectoryRelative() { + return base::FilePath(kCertificateRelativePath); } -FilePath GetWebSocketTestDataDirectory() { - FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); +base::FilePath GetWebSocketTestDataDirectory() { + base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); return data_dir; } diff --git a/net/base/test_data_directory.h b/net/base/test_data_directory.h index 0833c8e..2ed0ed6 100644 --- a/net/base/test_data_directory.h +++ b/net/base/test_data_directory.h @@ -11,16 +11,16 @@ namespace net { // Returns the FilePath object representing the absolute path in the source // tree that contains certificates for testing. -FilePath GetTestCertsDirectory(); +base::FilePath GetTestCertsDirectory(); -// Returns the FilePath object representing the path to the certificate +// Returns the base::FilePath object representing the path to the certificate // directory in relation to the source root. -FilePath GetTestCertsDirectoryRelative(); +base::FilePath GetTestCertsDirectoryRelative(); -// Returns the FilePath object representing the relative path containing +// Returns the base::FilePath object representing the relative path containing // resource files for testing WebSocket. Typically the FilePath will be used as // document root argument for net::TestServer with TYPE_WS or TYPE_WSS. -FilePath GetWebSocketTestDataDirectory(); +base::FilePath GetWebSocketTestDataDirectory(); } // namespace net diff --git a/net/base/test_root_certs.cc b/net/base/test_root_certs.cc index 5b742e1..83a98d1 100644 --- a/net/base/test_root_certs.cc +++ b/net/base/test_root_certs.cc @@ -20,7 +20,7 @@ bool g_has_instance = false; base::LazyInstance<TestRootCerts>::Leaky g_test_root_certs = LAZY_INSTANCE_INITIALIZER; -CertificateList LoadCertificates(const FilePath& filename) { +CertificateList LoadCertificates(const base::FilePath& filename) { std::string raw_cert; if (!file_util::ReadFileToString(filename, &raw_cert)) { LOG(ERROR) << "Can't load certificate " << filename.value(); @@ -42,7 +42,7 @@ bool TestRootCerts::HasInstance() { return g_has_instance; } -bool TestRootCerts::AddFromFile(const FilePath& file) { +bool TestRootCerts::AddFromFile(const base::FilePath& file) { CertificateList root_certs = LoadCertificates(file); if (root_certs.empty() || root_certs.size() > 1) return false; diff --git a/net/base/unix_domain_socket_posix_unittest.cc b/net/base/unix_domain_socket_posix_unittest.cc index bad626f..c8dfea1 100644 --- a/net/base/unix_domain_socket_posix_unittest.cc +++ b/net/base/unix_domain_socket_posix_unittest.cc @@ -52,7 +52,7 @@ enum EventType { }; string MakeSocketPath() { - FilePath temp_dir; + base::FilePath temp_dir; file_util::GetTempDir(&temp_dir); return temp_dir.Append(kSocketFilename).value(); } @@ -212,7 +212,7 @@ class UnixDomainSocketTestHelper : public testing::Test { return thread.Pass(); } - const FilePath file_path_; + const base::FilePath file_path_; const bool allow_user_; scoped_refptr<EventManager> event_manager_; scoped_ptr<TestListenSocketDelegate> socket_delegate_; diff --git a/net/base/upload_data.cc b/net/base/upload_data.cc index 5c53e08..48cb202 100644 --- a/net/base/upload_data.cc +++ b/net/base/upload_data.cc @@ -22,7 +22,7 @@ void UploadData::AppendBytes(const char* bytes, int bytes_len) { } } -void UploadData::AppendFileRange(const FilePath& file_path, +void UploadData::AppendFileRange(const base::FilePath& file_path, uint64 offset, uint64 length, const base::Time& expected_modification_time) { DCHECK(!is_chunked_); diff --git a/net/base/upload_data_stream_unittest.cc b/net/base/upload_data_stream_unittest.cc index 49c8da8..76ff088 100644 --- a/net/base/upload_data_stream_unittest.cc +++ b/net/base/upload_data_stream_unittest.cc @@ -126,7 +126,7 @@ class UploadDataStreamTest : public PlatformTest { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } - void FileChangedHelper(const FilePath& file_path, + void FileChangedHelper(const base::FilePath& file_path, const base::Time& time, bool error_expected); @@ -162,7 +162,7 @@ TEST_F(UploadDataStreamTest, ConsumeAllBytes) { } TEST_F(UploadDataStreamTest, File) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -192,7 +192,7 @@ TEST_F(UploadDataStreamTest, File) { } TEST_F(UploadDataStreamTest, FileSmallerThanLength) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -306,7 +306,7 @@ TEST_F(UploadDataStreamTest, ReadErrorAsync) { } TEST_F(UploadDataStreamTest, FileAndBytes) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -506,7 +506,7 @@ TEST_F(UploadDataStreamTest, ReadAsync) { EXPECT_EQ(static_cast<int>(kTestDataSize*2), read_callback3.WaitForResult()); } -void UploadDataStreamTest::FileChangedHelper(const FilePath& file_path, +void UploadDataStreamTest::FileChangedHelper(const base::FilePath& file_path, const base::Time& time, bool error_expected) { // Don't use element_readers_ here, as this function is called twice, and @@ -526,7 +526,7 @@ void UploadDataStreamTest::FileChangedHelper(const FilePath& file_path, } TEST_F(UploadDataStreamTest, FileChanged) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -545,7 +545,7 @@ TEST_F(UploadDataStreamTest, FileChanged) { } TEST_F(UploadDataStreamTest, MultipleInit) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -586,7 +586,7 @@ TEST_F(UploadDataStreamTest, MultipleInit) { } TEST_F(UploadDataStreamTest, MultipleInitAsync) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -626,7 +626,7 @@ TEST_F(UploadDataStreamTest, MultipleInitAsync) { } TEST_F(UploadDataStreamTest, InitToReset) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -678,7 +678,7 @@ TEST_F(UploadDataStreamTest, InitToReset) { } TEST_F(UploadDataStreamTest, InitDuringAsyncInit) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), @@ -722,7 +722,7 @@ TEST_F(UploadDataStreamTest, InitDuringAsyncInit) { } TEST_F(UploadDataStreamTest, InitDuringAsyncRead) { - FilePath temp_file_path; + base::FilePath temp_file_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), diff --git a/net/base/upload_element.h b/net/base/upload_element.h index 1e7a7fd..fceb747 100644 --- a/net/base/upload_element.h +++ b/net/base/upload_element.h @@ -29,7 +29,7 @@ class NET_EXPORT UploadElement { const char* bytes() const { return bytes_start_ ? bytes_start_ : &buf_[0]; } uint64 bytes_length() const { return buf_.size() + bytes_length_; } - const FilePath& file_path() const { return file_path_; } + const base::FilePath& file_path() const { return file_path_; } uint64 file_range_offset() const { return file_range_offset_; } uint64 file_range_length() const { return file_range_length_; } // If NULL time is returned, we do not do the check. @@ -51,14 +51,14 @@ class NET_EXPORT UploadElement { bytes_length_ = bytes_len; } - void SetToFilePath(const FilePath& path) { + void SetToFilePath(const base::FilePath& path) { SetToFilePathRange(path, 0, kuint64max, base::Time()); } // If expected_modification_time is NULL, we do not check for the file // change. Also note that the granularity for comparison is time_t, not // the full precision. - void SetToFilePathRange(const FilePath& path, + void SetToFilePathRange(const base::FilePath& path, uint64 offset, uint64 length, const base::Time& expected_modification_time) { type_ = TYPE_FILE; @@ -73,7 +73,7 @@ class NET_EXPORT UploadElement { std::vector<char> buf_; const char* bytes_start_; uint64 bytes_length_; - FilePath file_path_; + base::FilePath file_path_; uint64 file_range_offset_; uint64 file_range_length_; base::Time expected_file_modification_time_; diff --git a/net/base/upload_file_element_reader.cc b/net/base/upload_file_element_reader.cc index 0d2cff4..5bc3533 100644 --- a/net/base/upload_file_element_reader.cc +++ b/net/base/upload_file_element_reader.cc @@ -22,7 +22,7 @@ uint64 overriding_content_length = 0; // This function is used to implement Init(). template<typename FileStreamDeleter> -int InitInternal(const FilePath& path, +int InitInternal(const base::FilePath& path, uint64 range_offset, uint64 range_length, const base::Time& expected_modification_time, @@ -110,7 +110,7 @@ void UploadFileElementReader::FileStreamDeleter::operator() ( UploadFileElementReader::UploadFileElementReader( base::TaskRunner* task_runner, - const FilePath& path, + const base::FilePath& path, uint64 range_offset, uint64 range_length, const base::Time& expected_modification_time) @@ -240,7 +240,7 @@ UploadFileElementReader::ScopedOverridingContentLengthForTests:: } UploadFileElementReaderSync::UploadFileElementReaderSync( - const FilePath& path, + const base::FilePath& path, uint64 range_offset, uint64 range_length, const base::Time& expected_modification_time) diff --git a/net/base/upload_file_element_reader.h b/net/base/upload_file_element_reader.h index ad16bb2..392cf7c 100644 --- a/net/base/upload_file_element_reader.h +++ b/net/base/upload_file_element_reader.h @@ -27,13 +27,13 @@ class NET_EXPORT UploadFileElementReader : public UploadElementReader { public: // |task_runner| is used to perform file operations. It must not be NULL. UploadFileElementReader(base::TaskRunner* task_runner, - const FilePath& path, + const base::FilePath& path, uint64 range_offset, uint64 range_length, const base::Time& expected_modification_time); virtual ~UploadFileElementReader(); - const FilePath& path() const { return path_; } + const base::FilePath& path() const { return path_; } uint64 range_offset() const { return range_offset_; } uint64 range_length() const { return range_length_; } const base::Time& expected_modification_time() const { @@ -94,7 +94,7 @@ class NET_EXPORT UploadFileElementReader : public UploadElementReader { }; scoped_refptr<base::TaskRunner> task_runner_; - const FilePath path_; + const base::FilePath path_; const uint64 range_offset_; const uint64 range_length_; const base::Time expected_modification_time_; @@ -111,7 +111,7 @@ class NET_EXPORT UploadFileElementReader : public UploadElementReader { // Use this class only if the thread is IO allowed. class NET_EXPORT UploadFileElementReaderSync : public UploadElementReader { public: - UploadFileElementReaderSync(const FilePath& path, + UploadFileElementReaderSync(const base::FilePath& path, uint64 range_offset, uint64 range_length, const base::Time& expected_modification_time); @@ -126,7 +126,7 @@ class NET_EXPORT UploadFileElementReaderSync : public UploadElementReader { const CompletionCallback& callback) OVERRIDE; private: - const FilePath path_; + const base::FilePath path_; const uint64 range_offset_; const uint64 range_length_; const base::Time expected_modification_time_; diff --git a/net/base/upload_file_element_reader_unittest.cc b/net/base/upload_file_element_reader_unittest.cc index 41e69fd..672ad54 100644 --- a/net/base/upload_file_element_reader_unittest.cc +++ b/net/base/upload_file_element_reader_unittest.cc @@ -44,7 +44,7 @@ class UploadFileElementReaderTest : public PlatformTest { std::vector<char> bytes_; scoped_ptr<UploadElementReader> reader_; base::ScopedTempDir temp_dir_; - FilePath temp_file_path_; + base::FilePath temp_file_path_; }; TEST_F(UploadFileElementReaderTest, ReadPartially) { @@ -196,7 +196,7 @@ TEST_F(UploadFileElementReaderTest, FileChanged) { } TEST_F(UploadFileElementReaderTest, WrongPath) { - const FilePath wrong_path(FILE_PATH_LITERAL("wrong_path")); + const base::FilePath wrong_path(FILE_PATH_LITERAL("wrong_path")); reader_.reset(new UploadFileElementReader( base::MessageLoopProxy::current(), wrong_path, 0, kuint64max, base::Time())); @@ -234,7 +234,7 @@ class UploadFileElementReaderSyncTest : public PlatformTest { std::vector<char> bytes_; scoped_ptr<UploadElementReader> reader_; base::ScopedTempDir temp_dir_; - FilePath temp_file_path_; + base::FilePath temp_file_path_; }; TEST_F(UploadFileElementReaderSyncTest, ReadPartially) { @@ -327,7 +327,7 @@ TEST_F(UploadFileElementReaderSyncTest, FileChanged) { } TEST_F(UploadFileElementReaderSyncTest, WrongPath) { - const FilePath wrong_path(FILE_PATH_LITERAL("wrong_path")); + const base::FilePath wrong_path(FILE_PATH_LITERAL("wrong_path")); reader_.reset(new UploadFileElementReaderSync( wrong_path, 0, kuint64max, base::Time())); ASSERT_EQ(OK, reader_->Init(CompletionCallback())); diff --git a/net/base/x509_certificate_unittest.cc b/net/base/x509_certificate_unittest.cc index 5fc0bb3..a3d35fa 100644 --- a/net/base/x509_certificate_unittest.cc +++ b/net/base/x509_certificate_unittest.cc @@ -314,7 +314,7 @@ TEST(X509CertificateTest, ThawteCertParsing) { // one AVA per RDN, but some CAs place all AVAs within a single RDN. // This is a regression test for http://crbug.com/101009 TEST(X509CertificateTest, MultivalueRDN) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> multivalue_rdn_cert = ImportCertFromFile(certs_dir, "multivalue_rdn.pem"); @@ -338,7 +338,7 @@ TEST(X509CertificateTest, MultivalueRDN) { // such as '=' or '"', are not escaped when parsed as individual components. // This is a regression test for http://crbug.com/102839 TEST(X509CertificateTest, UnescapedSpecialCharacters) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> unescaped_cert = ImportCertFromFile(certs_dir, "unescaped.pem"); @@ -388,7 +388,7 @@ TEST(X509CertificateTest, SerialNumbers) { } TEST(X509CertificateTest, CAFingerprints) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "salesforce_com_test.pem"); @@ -442,7 +442,7 @@ TEST(X509CertificateTest, CAFingerprints) { } TEST(X509CertificateTest, ParseSubjectAltNames) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> san_cert = ImportCertFromFile(certs_dir, "subjectAltName_sanity_check.pem"); @@ -480,7 +480,7 @@ TEST(X509CertificateTest, ParseSubjectAltNames) { } TEST(X509CertificateTest, ExtractSPKIFromDERCert) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> cert = ImportCertFromFile(certs_dir, "nist.der"); ASSERT_NE(static_cast<X509Certificate*>(NULL), cert); @@ -500,7 +500,7 @@ TEST(X509CertificateTest, ExtractSPKIFromDERCert) { } TEST(X509CertificateTest, ExtractCRLURLsFromDERCert) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> cert = ImportCertFromFile(certs_dir, "nist.der"); ASSERT_NE(static_cast<X509Certificate*>(NULL), cert); @@ -682,7 +682,7 @@ TEST(X509CertificateTest, IntermediateCertificates) { } TEST(X509CertificateTest, IsIssuedByEncoded) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); // Test a client certificate from MIT. scoped_refptr<X509Certificate> mit_davidben_cert( @@ -724,7 +724,7 @@ TEST(X509CertificateTest, IsIssuedByEncoded) { } TEST(X509CertificateTest, IsIssuedByEncodedWithIntermediates) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); scoped_refptr<X509Certificate> server_cert = ImportCertFromFile(certs_dir, "www_us_army_mil_cert.der"); @@ -921,7 +921,7 @@ class X509CertificateParseTest }; TEST_P(X509CertificateParseTest, CanParseFormat) { - FilePath certs_dir = GetTestCertsDirectory(); + base::FilePath certs_dir = GetTestCertsDirectory(); CertificateList certs = CreateCertificateListFromFile( certs_dir, test_data_.file_name, test_data_.format); ASSERT_FALSE(certs.empty()); |