summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/base/auth.h4
-rw-r--r--net/base/auth_cache.cc4
-rw-r--r--net/base/auth_cache.h4
-rw-r--r--net/base/auth_cache_unittest.cc4
-rw-r--r--net/base/base64.cc4
-rw-r--r--net/base/base64.h4
-rw-r--r--net/base/base64_unittest.cc4
-rw-r--r--net/base/data_url.cc6
-rw-r--r--net/base/data_url.h4
-rw-r--r--net/base/data_url_unittest.cc9
-rw-r--r--net/base/directory_lister.cc4
-rw-r--r--net/base/directory_lister.h4
-rw-r--r--net/base/directory_lister_unittest.cc16
-rw-r--r--net/base/dns_resolution_observer.cc1
-rw-r--r--net/base/dns_resolution_observer.h2
-rw-r--r--net/base/mime_sniffer.cc4
-rw-r--r--net/base/mime_sniffer.h4
-rw-r--r--net/base/mime_sniffer_unittest.cc20
-rw-r--r--net/base/mime_util.cc8
-rw-r--r--net/base/mime_util.h4
-rw-r--r--net/base/mime_util_unittest.cc40
-rw-r--r--net/base/net_util.cc2
-rw-r--r--net/http/http_transaction_factory.h3
-rw-r--r--net/http/http_transaction_unittest.h2
-rw-r--r--net/url_request/mime_sniffer_proxy.cc6
-rw-r--r--net/url_request/mime_sniffer_proxy.h2
-rw-r--r--net/url_request/url_request.h2
-rw-r--r--net/url_request/url_request_context.h4
-rw-r--r--net/url_request/url_request_file_dir_job.cc2
-rw-r--r--net/url_request/url_request_file_dir_job.h4
-rw-r--r--net/url_request/url_request_file_job.cc2
-rw-r--r--net/url_request/url_request_ftp_job.cc21
-rw-r--r--net/url_request/url_request_ftp_job.h6
-rw-r--r--net/url_request/url_request_http_cache_job.cc44
-rw-r--r--net/url_request/url_request_http_cache_job.h10
-rw-r--r--net/url_request/url_request_inet_job.cc22
-rw-r--r--net/url_request/url_request_inet_job.h7
-rw-r--r--net/url_request/url_request_job.cc4
-rw-r--r--net/url_request/url_request_job.h6
-rw-r--r--net/url_request/url_request_unittest.h2
40 files changed, 173 insertions, 132 deletions
diff --git a/net/base/auth.h b/net/base/auth.h
index 92bc315..2cff79d 100644
--- a/net/base/auth.h
+++ b/net/base/auth.h
@@ -34,6 +34,8 @@
#include "base/ref_counted.h"
+namespace net {
+
// Holds info about an authentication challenge that we may want to display
// to the user.
class AuthChallengeInfo :
@@ -73,4 +75,6 @@ class AuthData : public base::RefCountedThreadSafe<AuthData> {
~AuthData() {}
};
+} // namespace net
+
#endif // NET_BASE_AUTH_H__
diff --git a/net/base/auth_cache.cc b/net/base/auth_cache.cc
index daa3afc..645d831 100644
--- a/net/base/auth_cache.cc
+++ b/net/base/auth_cache.cc
@@ -32,6 +32,8 @@
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
+namespace net {
+
// Create an AuthCacheKey from url and auth_info.
//
// The cache key is made up of two components, separated by a slash /.
@@ -67,3 +69,5 @@ AuthData* AuthCache::Lookup(const AuthCacheKey& key) {
AuthCacheMap::iterator iter = cache_.find(key);
return (iter == cache_.end()) ? NULL : iter->second;
}
+
+} // namespace net
diff --git a/net/base/auth_cache.h b/net/base/auth_cache.h
index d4357f6..555bcfd 100644
--- a/net/base/auth_cache.h
+++ b/net/base/auth_cache.h
@@ -37,7 +37,7 @@
class GURL;
-// TODO(wtc): move AuthCache into the net namespace.
+namespace net {
// The AuthCache class is a simple cache structure to store authentication
// information for ftp or http/https sites. Provides lookup, addition, and
@@ -81,4 +81,6 @@ class AuthCache {
AuthCacheMap cache_;
};
+} // namespace net
+
#endif // NET_BASE_AUTH_CACHE_H__
diff --git a/net/base/auth_cache_unittest.cc b/net/base/auth_cache_unittest.cc
index b43b9ce..1989e07 100644
--- a/net/base/auth_cache_unittest.cc
+++ b/net/base/auth_cache_unittest.cc
@@ -39,7 +39,7 @@ class AuthCacheTest : public testing::Test {
} // namespace
TEST(AuthCacheTest, HttpKey) {
- scoped_refptr<AuthChallengeInfo> auth_info = new AuthChallengeInfo;
+ scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo;
auth_info->is_proxy = false; // server auth
// auth_info->host is intentionally left empty.
auth_info->scheme = L"Basic";
@@ -66,7 +66,7 @@ TEST(AuthCacheTest, HttpKey) {
};
for (int i = 0; i < arraysize(url); i++) {
- std::string key = AuthCache::HttpKey(GURL(url[i]), *auth_info);
+ std::string key = net::AuthCache::HttpKey(GURL(url[i]), *auth_info);
EXPECT_EQ(expected[i], key);
}
}
diff --git a/net/base/base64.cc b/net/base/base64.cc
index dcb5781..05716f5b 100644
--- a/net/base/base64.cc
+++ b/net/base/base64.cc
@@ -34,6 +34,8 @@
#include "third_party/modp_b64/modp_b64.h"
#pragma warning(pop)
+namespace net {
+
bool Base64Encode(const std::string& input, std::string* output) {
std::string temp;
temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte
@@ -63,3 +65,5 @@ bool Base64Decode(const std::string& input, std::string* output) {
output->swap(temp);
return true;
}
+
+} // namespace net
diff --git a/net/base/base64.h b/net/base/base64.h
index 83511d8..f2452d1 100644
--- a/net/base/base64.h
+++ b/net/base/base64.h
@@ -32,6 +32,8 @@
#include <string>
+namespace net {
+
// Encodes the input string in base64. Returns true if successful and false
// otherwise. The output string is only modified if successful.
bool Base64Encode(const std::string& input, std::string* output);
@@ -40,4 +42,6 @@ bool Base64Encode(const std::string& input, std::string* output);
// otherwise. The output string is only modified if successful.
bool Base64Decode(const std::string& input, std::string* output);
+} // namespace net
+
#endif // NET_BASE_BASE64_H__
diff --git a/net/base/base64_unittest.cc b/net/base/base64_unittest.cc
index 58b3d26..40296c2 100644
--- a/net/base/base64_unittest.cc
+++ b/net/base/base64_unittest.cc
@@ -44,11 +44,11 @@ TEST(Base64Test, Basic) {
std::string encoded, decoded;
bool ok;
- ok = Base64Encode(kText, &encoded);
+ ok = net::Base64Encode(kText, &encoded);
EXPECT_TRUE(ok);
EXPECT_EQ(kBase64Text, encoded);
- ok = Base64Decode(encoded, &decoded);
+ ok = net::Base64Decode(encoded, &decoded);
EXPECT_TRUE(ok);
EXPECT_EQ(kText, decoded);
}
diff --git a/net/base/data_url.cc b/net/base/data_url.cc
index cf8e239..4040a66 100644
--- a/net/base/data_url.cc
+++ b/net/base/data_url.cc
@@ -38,7 +38,9 @@
#include "net/base/base64.h"
#include "net/base/escape.h"
-/*static*/
+namespace net {
+
+// static
bool DataURL::Parse(const GURL& url, std::string* mime_type,
std::string* charset, std::string* data) {
std::string::const_iterator begin = url.spec().begin();
@@ -119,3 +121,5 @@ bool DataURL::Parse(const GURL& url, std::string* mime_type,
temp_data.swap(*data);
return true;
}
+
+} // namespace net
diff --git a/net/base/data_url.h b/net/base/data_url.h
index 06c3ab1..b9b6f63 100644
--- a/net/base/data_url.h
+++ b/net/base/data_url.h
@@ -31,6 +31,8 @@
class GURL;
+namespace net {
+
// See RFC 2397 for a complete description of the 'data' URL scheme.
//
// Briefly, a 'data' URL has the form:
@@ -61,3 +63,5 @@ class DataURL {
std::string* charset,
std::string* data);
};
+
+} // namespace net
diff --git a/net/base/data_url_unittest.cc b/net/base/data_url_unittest.cc
index 99865df..3eae2d5 100644
--- a/net/base/data_url_unittest.cc
+++ b/net/base/data_url_unittest.cc
@@ -33,8 +33,10 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
- class DataURLTest : public testing::Test {
- };
+
+class DataURLTest : public testing::Test {
+};
+
}
TEST(DataURLTest, Parse) {
@@ -165,7 +167,8 @@ TEST(DataURLTest, Parse) {
std::string mime_type;
std::string charset;
std::string data;
- bool ok = DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data);
+ bool ok =
+ net::DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data);
EXPECT_EQ(ok, tests[i].is_valid);
if (tests[i].is_valid) {
EXPECT_EQ(tests[i].mime_type, mime_type);
diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc
index 44dd251..87f820d 100644
--- a/net/base/directory_lister.cc
+++ b/net/base/directory_lister.cc
@@ -33,6 +33,8 @@
#include "base/message_loop.h"
+namespace net {
+
static const int kFilesPerEvent = 8;
class DirectoryDataEvent : public Task {
@@ -161,3 +163,5 @@ void DirectoryLister::OnDone(int error) {
if (delegate_)
delegate_->OnListDone(error);
}
+
+} // namespace net
diff --git a/net/base/directory_lister.h b/net/base/directory_lister.h
index b3b0949..c640c99 100644
--- a/net/base/directory_lister.h
+++ b/net/base/directory_lister.h
@@ -37,6 +37,8 @@
class MessageLoop;
+namespace net {
+
//
// This class provides an API for listing the contents of a directory on the
// filesystem asynchronously. It spawns a background thread, and enumerates
@@ -89,4 +91,6 @@ class DirectoryLister : public base::RefCountedThreadSafe<DirectoryLister> {
bool canceled_;
};
+} // namespace net
+
#endif // NET_BASE_DIRECTORY_LISTER_H__
diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc
index b1cbc4a..f93e27a 100644
--- a/net/base/directory_lister_unittest.cc
+++ b/net/base/directory_lister_unittest.cc
@@ -33,11 +33,13 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace {
- class DirectoryListerTest : public testing::Test {
- };
+
+class DirectoryListerTest : public testing::Test {
+};
+
}
-class DirectoryListerDelegate : public DirectoryLister::Delegate {
+class DirectoryListerDelegate : public net::DirectoryLister::Delegate {
public:
DirectoryListerDelegate() : error_(-1) {
}
@@ -57,8 +59,8 @@ TEST(DirectoryListerTest, BigDirTest) {
ASSERT_TRUE(PathService::Get(base::DIR_WINDOWS, &windows_path));
DirectoryListerDelegate delegate;
- scoped_refptr<DirectoryLister> lister =
- new DirectoryLister(windows_path, &delegate);
+ scoped_refptr<net::DirectoryLister> lister =
+ new net::DirectoryLister(windows_path, &delegate);
lister->Start();
@@ -72,8 +74,8 @@ TEST(DirectoryListerTest, CancelTest) {
ASSERT_TRUE(PathService::Get(base::DIR_WINDOWS, &windows_path));
DirectoryListerDelegate delegate;
- scoped_refptr<DirectoryLister> lister =
- new DirectoryLister(windows_path, &delegate);
+ scoped_refptr<net::DirectoryLister> lister =
+ new net::DirectoryLister(windows_path, &delegate);
lister->Start();
lister->Cancel();
diff --git a/net/base/dns_resolution_observer.cc b/net/base/dns_resolution_observer.cc
index c66be8f..c9c9933 100644
--- a/net/base/dns_resolution_observer.cc
+++ b/net/base/dns_resolution_observer.cc
@@ -82,4 +82,5 @@ void DidFinishDnsResolutionWithStatus(bool was_resolved, void* context) {
current_observer->OnFinishResolutionWithStatus(was_resolved, context);
}
}
+
} // namspace net
diff --git a/net/base/dns_resolution_observer.h b/net/base/dns_resolution_observer.h
index 08ef6bf..f36172b 100644
--- a/net/base/dns_resolution_observer.h
+++ b/net/base/dns_resolution_observer.h
@@ -76,5 +76,7 @@ DnsResolutionObserver* RemoveDnsResolutionObserver();
// to any registered observer.
void DidStartDnsResolution(const std::string& name, void* context);
void DidFinishDnsResolutionWithStatus(bool was_resolved, void* context);
+
} // namspace net
+
#endif // NET_BASE_DNS_RESOLUTION_OBSERVER_H__
diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc
index 12aec1d..b5d37dc 100644
--- a/net/base/mime_sniffer.cc
+++ b/net/base/mime_sniffer.cc
@@ -137,7 +137,7 @@ class SnifferHistogram : public LinearHistogram {
} // namespace
-namespace mime_util {
+namespace net {
// We aren't interested in looking at more than 512 bytes of content
static const size_t kMaxBytesToSniff = 512;
@@ -620,4 +620,4 @@ bool SniffMimeType(const char* content, size_t content_size,
return have_enough_content;
}
-} // namespace mime_util
+} // namespace net
diff --git a/net/base/mime_sniffer.h b/net/base/mime_sniffer.h
index 352343c..39a419b 100644
--- a/net/base/mime_sniffer.h
+++ b/net/base/mime_sniffer.h
@@ -34,7 +34,7 @@
class GURL;
-namespace mime_util {
+namespace net {
// Examine the URL and the mime_type and decide whether we should sniff a
// replacement mime type from the content.
@@ -57,6 +57,6 @@ bool SniffMimeType(const char* content, size_t content_size,
const GURL& url, const std::string& type_hint,
std::string* result);
-} // namespace mime_util
+} // namespace net
#endif // NET_BASE_MIME_SNIFFER_H__
diff --git a/net/base/mime_sniffer_unittest.cc b/net/base/mime_sniffer_unittest.cc
index 0d1011f..786a5a0 100644
--- a/net/base/mime_sniffer_unittest.cc
+++ b/net/base/mime_sniffer_unittest.cc
@@ -49,11 +49,11 @@ static void TestArray(SnifferTest* tests, size_t count) {
std::string mime_type;
for (size_t i = 0; i < count; ++i) {
- mime_util::SniffMimeType(tests[i].content,
- tests[i].content_len,
- GURL(tests[i].url),
- tests[i].type_hint,
- &mime_type);
+ net::SniffMimeType(tests[i].content,
+ tests[i].content_len,
+ GURL(tests[i].url),
+ tests[i].type_hint,
+ &mime_type);
EXPECT_EQ(tests[i].mime_type, mime_type);
}
}
@@ -64,8 +64,8 @@ static std::string SniffMimeType(const std::string& content,
const std::string& url,
const std::string& mime_type_hint) {
std::string mime_type;
- mime_util::SniffMimeType(content.data(), content.size(), GURL(url),
- mime_type_hint, &mime_type);
+ net::SniffMimeType(content.data(), content.size(), GURL(url),
+ mime_type_hint, &mime_type);
return mime_type;
}
@@ -79,11 +79,11 @@ TEST(MimeSnifferTest, BoundaryConditionsTest) {
GURL url;
- mime_util::SniffMimeType(buf, 0, url, type_hint, &mime_type);
+ net::SniffMimeType(buf, 0, url, type_hint, &mime_type);
EXPECT_EQ("text/plain", mime_type);
- mime_util::SniffMimeType(buf, 1, url, type_hint, &mime_type);
+ net::SniffMimeType(buf, 1, url, type_hint, &mime_type);
EXPECT_EQ("text/plain", mime_type);
- mime_util::SniffMimeType(buf, 2, url, type_hint, &mime_type);
+ net::SniffMimeType(buf, 2, url, type_hint, &mime_type);
EXPECT_EQ("application/octet-stream", mime_type);
}
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 71421f9..8595311 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -40,7 +40,7 @@
using std::string;
using std::wstring;
-namespace mime_util {
+namespace net {
struct MimeInfo {
const char* mime_type;
@@ -259,8 +259,8 @@ bool IsViewSourceMimeType(const char* mime_type) {
bool IsSupportedMimeType(const std::string& mime_type) {
if (mime_type.compare(0, 5, "text/") == 0 ||
(mime_type.compare(0, 6, "image/") == 0 &&
- mime_util::IsSupportedImageMimeType(mime_type.c_str())) ||
- mime_util::IsSupportedNonImageMimeType(mime_type.c_str()))
+ IsSupportedImageMimeType(mime_type.c_str())) ||
+ IsSupportedNonImageMimeType(mime_type.c_str()))
return true;
return false;
}
@@ -302,4 +302,4 @@ bool MatchesMimeType(const std::string &mime_type_pattern,
return true;
}
-} // namespace mime_util
+} // namespace net
diff --git a/net/base/mime_util.h b/net/base/mime_util.h
index 047e79c..40d8b22 100644
--- a/net/base/mime_util.h
+++ b/net/base/mime_util.h
@@ -32,7 +32,7 @@
#include <string>
-namespace mime_util {
+namespace net {
// Get the mime type (if any) that is associated with the given file extension.
// Returns true if a corresponding mime type exists.
@@ -66,6 +66,6 @@ bool IsSupportedMimeType(const std::string& mime_type);
bool MatchesMimeType(const std::string &mime_type_pattern,
const std::string &mime_type);
-} // namespace mime_util
+} // namespace net
#endif // NET_BASE_MIME_UTIL_H__
diff --git a/net/base/mime_util_unittest.cc b/net/base/mime_util_unittest.cc
index 3031d1b..468e2c7 100644
--- a/net/base/mime_util_unittest.cc
+++ b/net/base/mime_util_unittest.cc
@@ -53,7 +53,7 @@ TEST(MimeUtilTest, ExtensionTest) {
bool rv;
for (size_t i = 0; i < arraysize(tests); ++i) {
- rv = mime_util::GetMimeTypeFromExtension(tests[i].extension, &mime_type);
+ rv = net::GetMimeTypeFromExtension(tests[i].extension, &mime_type);
EXPECT_EQ(rv, tests[i].valid);
if (rv)
EXPECT_EQ(mime_type, tests[i].mime_type);
@@ -75,7 +75,7 @@ TEST(MimeUtilTest, FileTest) {
bool rv;
for (size_t i = 0; i < arraysize(tests); ++i) {
- rv = mime_util::GetMimeTypeFromFile(tests[i].file_path, &mime_type);
+ rv = net::GetMimeTypeFromFile(tests[i].file_path, &mime_type);
EXPECT_EQ(rv, tests[i].valid);
if (rv)
EXPECT_EQ(mime_type, tests[i].mime_type);
@@ -83,32 +83,32 @@ TEST(MimeUtilTest, FileTest) {
}
TEST(MimeUtilTest, LookupTypes) {
- EXPECT_EQ(true, mime_util::IsSupportedImageMimeType("image/jpeg"));
- EXPECT_EQ(false, mime_util::IsSupportedImageMimeType("image/lolcat"));
- EXPECT_EQ(true, mime_util::IsSupportedNonImageMimeType("text/html"));
- EXPECT_EQ(false, mime_util::IsSupportedNonImageMimeType("text/virus"));
+ EXPECT_EQ(true, net::IsSupportedImageMimeType("image/jpeg"));
+ EXPECT_EQ(false, net::IsSupportedImageMimeType("image/lolcat"));
+ EXPECT_EQ(true, net::IsSupportedNonImageMimeType("text/html"));
+ EXPECT_EQ(false, net::IsSupportedNonImageMimeType("text/virus"));
}
TEST(MimeUtilTest, MatchesMimeType) {
- EXPECT_EQ(true, mime_util::MatchesMimeType("*", "video/x-mpeg"));
- EXPECT_EQ(true, mime_util::MatchesMimeType("video/*", "video/x-mpeg"));
- EXPECT_EQ(true, mime_util::MatchesMimeType("video/x-mpeg", "video/x-mpeg"));
- EXPECT_EQ(true, mime_util::MatchesMimeType("application/*+xml",
+ EXPECT_EQ(true, net::MatchesMimeType("*", "video/x-mpeg"));
+ EXPECT_EQ(true, net::MatchesMimeType("video/*", "video/x-mpeg"));
+ EXPECT_EQ(true, net::MatchesMimeType("video/x-mpeg", "video/x-mpeg"));
+ EXPECT_EQ(true, net::MatchesMimeType("application/*+xml",
"application/html+xml"));
- EXPECT_EQ(true, mime_util::MatchesMimeType("application/*+xml",
+ EXPECT_EQ(true, net::MatchesMimeType("application/*+xml",
"application/+xml"));
- EXPECT_EQ(true, mime_util::MatchesMimeType("aaa*aaa",
+ EXPECT_EQ(true, net::MatchesMimeType("aaa*aaa",
"aaaaaa"));
- EXPECT_EQ(false, mime_util::MatchesMimeType("video/", "video/x-mpeg"));
- EXPECT_EQ(false, mime_util::MatchesMimeType("", "video/x-mpeg"));
- EXPECT_EQ(false, mime_util::MatchesMimeType("", ""));
- EXPECT_EQ(false, mime_util::MatchesMimeType("video/x-mpeg", ""));
- EXPECT_EQ(false, mime_util::MatchesMimeType("application/*+xml",
+ EXPECT_EQ(false, net::MatchesMimeType("video/", "video/x-mpeg"));
+ EXPECT_EQ(false, net::MatchesMimeType("", "video/x-mpeg"));
+ EXPECT_EQ(false, net::MatchesMimeType("", ""));
+ EXPECT_EQ(false, net::MatchesMimeType("video/x-mpeg", ""));
+ EXPECT_EQ(false, net::MatchesMimeType("application/*+xml",
"application/xml"));
- EXPECT_EQ(false, mime_util::MatchesMimeType("application/*+xml",
+ EXPECT_EQ(false, net::MatchesMimeType("application/*+xml",
"application/html+xmlz"));
- EXPECT_EQ(false, mime_util::MatchesMimeType("application/*+xml",
+ EXPECT_EQ(false, net::MatchesMimeType("application/*+xml",
"applcation/html+xml"));
- EXPECT_EQ(false, mime_util::MatchesMimeType("aaa*aaa",
+ EXPECT_EQ(false, net::MatchesMimeType("aaa*aaa",
"aaaaa"));
}
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 416252c..8996182 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -219,7 +219,7 @@ bool DecodeBQEncoding(const std::string& part, RFC2047EncodingType enc_type,
const std::string& charset, std::string* output) {
std::string decoded;
if (enc_type == B_ENCODING) {
- if (!Base64Decode(part, &decoded)) {
+ if (!net::Base64Decode(part, &decoded)) {
return false;
}
} else {
diff --git a/net/http/http_transaction_factory.h b/net/http/http_transaction_factory.h
index 013a48d..f800c9e 100644
--- a/net/http/http_transaction_factory.h
+++ b/net/http/http_transaction_factory.h
@@ -30,10 +30,9 @@
#ifndef NET_HTTP_HTTP_TRANSACTION_FACTORY_H__
#define NET_HTTP_HTTP_TRANSACTION_FACTORY_H__
-class AuthCache;
-
namespace net {
+class AuthCache;
class HttpCache;
class HttpTransaction;
diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h
index 32f8a5a..f2165e7 100644
--- a/net/http/http_transaction_unittest.h
+++ b/net/http/http_transaction_unittest.h
@@ -324,7 +324,7 @@ class MockNetworkLayer : public net::HttpTransactionFactory {
return NULL;
}
- virtual AuthCache* GetAuthCache() {
+ virtual net::AuthCache* GetAuthCache() {
return NULL;
}
diff --git a/net/url_request/mime_sniffer_proxy.cc b/net/url_request/mime_sniffer_proxy.cc
index 2a0dec6..47568d9 100644
--- a/net/url_request/mime_sniffer_proxy.cc
+++ b/net/url_request/mime_sniffer_proxy.cc
@@ -41,7 +41,7 @@ MimeSnifferProxy::MimeSnifferProxy(URLRequest* request,
void MimeSnifferProxy::OnResponseStarted(URLRequest* request) {
if (request->status().is_success()) {
request->GetMimeType(&mime_type_);
- if (mime_util::ShouldSniffMimeType(request->url(), mime_type_)) {
+ if (net::ShouldSniffMimeType(request->url(), mime_type_)) {
// We need to read content before we know the mime type,
// so we don't call OnResponseStarted.
sniff_content_ = true;
@@ -82,8 +82,8 @@ void MimeSnifferProxy::OnReadCompleted(URLRequest* request, int bytes_read) {
std::string type_hint;
request_->GetMimeType(&type_hint);
bytes_read_ = bytes_read;
- mime_util::SniffMimeType(buf_, bytes_read_,
- request_->url(), type_hint, &mime_type_);
+ net::SniffMimeType(
+ buf_, bytes_read_, request_->url(), type_hint, &mime_type_);
} else {
error_ = true;
}
diff --git a/net/url_request/mime_sniffer_proxy.h b/net/url_request/mime_sniffer_proxy.h
index 7246e46..af02dfd 100644
--- a/net/url_request/mime_sniffer_proxy.h
+++ b/net/url_request/mime_sniffer_proxy.h
@@ -63,7 +63,7 @@ class MimeSnifferProxy : public URLRequest::Delegate {
delegate_->OnReceivedRedirect(request, new_url);
}
virtual void OnAuthRequired(URLRequest* request,
- AuthChallengeInfo* auth_info) {
+ net::AuthChallengeInfo* auth_info) {
delegate_->OnAuthRequired(request, auth_info);
}
virtual void OnSSLCertificateError(URLRequest* request,
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index 89b36b0..6740975 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -132,7 +132,7 @@ class URLRequest {
// When it does so, the request will be reissued, restarting the sequence
// of On* callbacks.
virtual void OnAuthRequired(URLRequest* request,
- AuthChallengeInfo* auth_info) {
+ net::AuthChallengeInfo* auth_info) {
request->CancelAuth();
}
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 059df6c..63b8f45 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -68,7 +68,7 @@ class URLRequestContext :
CookiePolicy* cookie_policy() { return &cookie_policy_; }
// Gets the FTP realm authentication cache for this context.
- AuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
+ net::AuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
// Gets the UA string to use for this context.
const std::string& user_agent() const { return user_agent_; }
@@ -92,7 +92,7 @@ class URLRequestContext :
net::HttpTransactionFactory* http_transaction_factory_;
CookieMonster* cookie_store_;
CookiePolicy cookie_policy_;
- AuthCache ftp_auth_cache_;
+ net::AuthCache ftp_auth_cache_;
std::string user_agent_;
bool is_off_the_record_;
std::string accept_language_;
diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc
index 5ad44a6..5845abf 100644
--- a/net/url_request/url_request_file_dir_job.cc
+++ b/net/url_request/url_request_file_dir_job.cc
@@ -73,7 +73,7 @@ void URLRequestFileDirJob::StartAsync() {
// is trying to feed us data.
AddRef();
- lister_ = new DirectoryLister(dir_path_, this);
+ lister_ = new net::DirectoryLister(dir_path_, this);
lister_->Start();
NotifyHeadersComplete();
diff --git a/net/url_request/url_request_file_dir_job.h b/net/url_request/url_request_file_dir_job.h
index 78d6863..618b067 100644
--- a/net/url_request/url_request_file_dir_job.h
+++ b/net/url_request/url_request_file_dir_job.h
@@ -34,7 +34,7 @@
#include "net/url_request/url_request_job.h"
class URLRequestFileDirJob : public URLRequestJob,
- public DirectoryLister::Delegate {
+ public net::DirectoryLister::Delegate {
public:
URLRequestFileDirJob(URLRequest* request, const std::wstring& dir_path);
virtual ~URLRequestFileDirJob();
@@ -61,7 +61,7 @@ class URLRequestFileDirJob : public URLRequestJob,
// Fills a buffer with the output.
bool FillReadBuffer(char *buf, int buf_size, int *bytes_read);
- scoped_refptr<DirectoryLister> lister_;
+ scoped_refptr<net::DirectoryLister> lister_;
std::wstring dir_path_;
std::string data_;
bool canceled_;
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 17e5f5c..e469047 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -221,7 +221,7 @@ bool URLRequestFileJob::ReadRawData(char* dest, int dest_size,
bool URLRequestFileJob::GetMimeType(std::string* mime_type) {
DCHECK(request_);
- return mime_util::GetMimeTypeFromFile(file_path_, mime_type);
+ return net::GetMimeTypeFromFile(file_path_, mime_type);
}
void URLRequestFileJob::CloseHandles() {
diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc
index f619609..134cb61 100644
--- a/net/url_request/url_request_ftp_job.cc
+++ b/net/url_request/url_request_ftp_job.cc
@@ -146,7 +146,7 @@ void URLRequestFtpJob::SendRequest() {
// in the url (if anything).
string username, password;
bool have_auth = false;
- if (server_auth_ != NULL && server_auth_->state == AUTH_STATE_HAVE_AUTH) {
+ if (server_auth_ && server_auth_->state == net::AUTH_STATE_HAVE_AUTH) {
// Add auth info to cache
have_auth = true;
username = WideToUTF8(server_auth_->username);
@@ -194,13 +194,13 @@ void URLRequestFtpJob::OnIOComplete(const AsyncResult& result) {
// fall through
case ERROR_INTERNET_INCORRECT_PASSWORD:
if (server_auth_ != NULL &&
- server_auth_->state == AUTH_STATE_HAVE_AUTH) {
+ server_auth_->state == net::AUTH_STATE_HAVE_AUTH) {
request_->context()->ftp_auth_cache()->Remove(request_->url().host());
} else {
- server_auth_ = new AuthData();
+ server_auth_ = new net::AuthData();
}
// Try again, prompting for authentication.
- server_auth_->state = AUTH_STATE_NEED_AUTH;
+ server_auth_->state = net::AUTH_STATE_NEED_AUTH;
// The io completed fine, the error was due to invalid auth.
SetStatus(URLRequestStatus());
NotifyHeadersComplete();
@@ -271,15 +271,14 @@ bool URLRequestFtpJob::NeedsAuth() {
// requires auth (and not a proxy), because connecting to FTP via proxy
// effectively means the browser communicates via HTTP, and uses HTTP's
// Proxy-Authenticate protocol when proxy servers require auth.
- return ((server_auth_ != NULL) &&
- server_auth_->state == AUTH_STATE_NEED_AUTH);
+ return server_auth_ && server_auth_->state == net::AUTH_STATE_NEED_AUTH;
}
void URLRequestFtpJob::GetAuthChallengeInfo(
- scoped_refptr<AuthChallengeInfo>* result) {
+ scoped_refptr<net::AuthChallengeInfo>* result) {
DCHECK((server_auth_ != NULL) &&
- (server_auth_->state == AUTH_STATE_NEED_AUTH));
- scoped_refptr<AuthChallengeInfo> auth_info = new AuthChallengeInfo;
+ (server_auth_->state == net::AUTH_STATE_NEED_AUTH));
+ scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo;
auth_info->is_proxy = false;
auth_info->host = UTF8ToWide(request_->url().host());
auth_info->scheme = L"";
@@ -288,8 +287,8 @@ void URLRequestFtpJob::GetAuthChallengeInfo(
}
void URLRequestFtpJob::GetCachedAuthData(
- const AuthChallengeInfo& auth_info,
- scoped_refptr<AuthData>* auth_data) {
+ const net::AuthChallengeInfo& auth_info,
+ scoped_refptr<net::AuthData>* auth_data) {
*auth_data = request_->context()->ftp_auth_cache()->
Lookup(WideToUTF8(auth_info.host));
}
diff --git a/net/url_request/url_request_ftp_job.h b/net/url_request/url_request_ftp_job.h
index ae47dbf..654262d 100644
--- a/net/url_request/url_request_ftp_job.h
+++ b/net/url_request/url_request_ftp_job.h
@@ -57,9 +57,9 @@ class URLRequestFtpJob : public URLRequestInetJob {
virtual void OnCancelAuth();
virtual void OnSetAuth();
virtual bool NeedsAuth();
- virtual void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*);
- virtual void GetCachedAuthData(const AuthChallengeInfo& auth_info,
- scoped_refptr<AuthData>* auth_data);
+ virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*);
+ virtual void GetCachedAuthData(const net::AuthChallengeInfo& auth_info,
+ scoped_refptr<net::AuthData>* auth_data);
virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
private:
diff --git a/net/url_request/url_request_http_cache_job.cc b/net/url_request/url_request_http_cache_job.cc
index 9537638..d583f96 100644
--- a/net/url_request/url_request_http_cache_job.cc
+++ b/net/url_request/url_request_http_cache_job.cc
@@ -66,8 +66,8 @@ URLRequestHttpCacheJob::URLRequestHttpCacheJob(URLRequest* request)
context_(request->context()),
transaction_(NULL),
response_info_(NULL),
- proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH),
- server_auth_state_(AUTH_STATE_DONT_NEED_AUTH),
+ proxy_auth_state_(net::AUTH_STATE_DONT_NEED_AUTH),
+ server_auth_state_(net::AUTH_STATE_DONT_NEED_AUTH),
start_callback_(this, &URLRequestHttpCacheJob::OnStartCompleted),
read_callback_(this, &URLRequestHttpCacheJob::OnReadCompleted),
read_in_progress_(false) {
@@ -238,27 +238,27 @@ bool URLRequestHttpCacheJob::NeedsAuth() {
// because we either provided no auth info, or provided incorrect info.
switch (code) {
case 407:
- if (proxy_auth_state_ == AUTH_STATE_CANCELED)
+ if (proxy_auth_state_ == net::AUTH_STATE_CANCELED)
return false;
- proxy_auth_state_ = AUTH_STATE_NEED_AUTH;
+ proxy_auth_state_ = net::AUTH_STATE_NEED_AUTH;
return true;
case 401:
- if (server_auth_state_ == AUTH_STATE_CANCELED)
+ if (server_auth_state_ == net::AUTH_STATE_CANCELED)
return false;
- server_auth_state_ = AUTH_STATE_NEED_AUTH;
+ server_auth_state_ = net::AUTH_STATE_NEED_AUTH;
return true;
}
return false;
}
void URLRequestHttpCacheJob::GetAuthChallengeInfo(
- scoped_refptr<AuthChallengeInfo>* result) {
+ scoped_refptr<net::AuthChallengeInfo>* result) {
DCHECK(transaction_);
DCHECK(response_info_);
// sanity checks:
- DCHECK(proxy_auth_state_ == AUTH_STATE_NEED_AUTH ||
- server_auth_state_ == AUTH_STATE_NEED_AUTH);
+ DCHECK(proxy_auth_state_ == net::AUTH_STATE_NEED_AUTH ||
+ server_auth_state_ == net::AUTH_STATE_NEED_AUTH);
DCHECK(response_info_->headers->response_code() == 401 ||
response_info_->headers->response_code() == 407);
@@ -266,16 +266,16 @@ void URLRequestHttpCacheJob::GetAuthChallengeInfo(
}
void URLRequestHttpCacheJob::GetCachedAuthData(
- const AuthChallengeInfo& auth_info,
- scoped_refptr<AuthData>* auth_data) {
- AuthCache* auth_cache =
+ const net::AuthChallengeInfo& auth_info,
+ scoped_refptr<net::AuthData>* auth_data) {
+ net::AuthCache* auth_cache =
request_->context()->http_transaction_factory()->GetAuthCache();
if (!auth_cache) {
*auth_data = NULL;
return;
}
- std::string auth_cache_key = AuthCache::HttpKey(request_->url(),
- auth_info);
+ std::string auth_cache_key =
+ net::AuthCache::HttpKey(request_->url(), auth_info);
*auth_data = auth_cache->Lookup(auth_cache_key);
}
@@ -284,11 +284,11 @@ void URLRequestHttpCacheJob::SetAuth(const std::wstring& username,
DCHECK(transaction_);
// Proxy gets set first, then WWW.
- if (proxy_auth_state_ == AUTH_STATE_NEED_AUTH) {
- proxy_auth_state_ = AUTH_STATE_HAVE_AUTH;
+ if (proxy_auth_state_ == net::AUTH_STATE_NEED_AUTH) {
+ proxy_auth_state_ = net::AUTH_STATE_HAVE_AUTH;
} else {
- DCHECK(server_auth_state_ == AUTH_STATE_NEED_AUTH);
- server_auth_state_ = AUTH_STATE_HAVE_AUTH;
+ DCHECK(server_auth_state_ == net::AUTH_STATE_NEED_AUTH);
+ server_auth_state_ = net::AUTH_STATE_HAVE_AUTH;
}
// These will be reset in OnStartCompleted.
@@ -312,11 +312,11 @@ void URLRequestHttpCacheJob::SetAuth(const std::wstring& username,
void URLRequestHttpCacheJob::CancelAuth() {
// Proxy gets set first, then WWW.
- if (proxy_auth_state_ == AUTH_STATE_NEED_AUTH) {
- proxy_auth_state_ = AUTH_STATE_CANCELED;
+ if (proxy_auth_state_ == net::AUTH_STATE_NEED_AUTH) {
+ proxy_auth_state_ = net::AUTH_STATE_CANCELED;
} else {
- DCHECK(server_auth_state_ == AUTH_STATE_NEED_AUTH);
- server_auth_state_ = AUTH_STATE_CANCELED;
+ DCHECK(server_auth_state_ == net::AUTH_STATE_NEED_AUTH);
+ server_auth_state_ = net::AUTH_STATE_CANCELED;
}
// These will be reset in OnStartCompleted.
diff --git a/net/url_request/url_request_http_cache_job.h b/net/url_request/url_request_http_cache_job.h
index 261d66b..249bc7d 100644
--- a/net/url_request/url_request_http_cache_job.h
+++ b/net/url_request/url_request_http_cache_job.h
@@ -67,9 +67,9 @@ class URLRequestHttpCacheJob : public URLRequestJob {
virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
virtual bool IsSafeRedirect(const GURL& location);
virtual bool NeedsAuth();
- virtual void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*);
- virtual void GetCachedAuthData(const AuthChallengeInfo& auth_info,
- scoped_refptr<AuthData>* auth_data);
+ virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*);
+ virtual void GetCachedAuthData(const net::AuthChallengeInfo& auth_info,
+ scoped_refptr<net::AuthData>* auth_data);
virtual void SetAuth(const std::wstring& username,
const std::wstring& password);
virtual void CancelAuth();
@@ -94,8 +94,8 @@ class URLRequestHttpCacheJob : public URLRequestJob {
std::vector<std::string> response_cookies_;
// Auth states for proxy and origin server.
- AuthState proxy_auth_state_;
- AuthState server_auth_state_;
+ net::AuthState proxy_auth_state_;
+ net::AuthState server_auth_state_;
net::CompletionCallbackImpl<URLRequestHttpCacheJob> start_callback_;
net::CompletionCallbackImpl<URLRequestHttpCacheJob> read_callback_;
diff --git a/net/url_request/url_request_inet_job.cc b/net/url_request/url_request_inet_job.cc
index ab4f91b..e2d80fd 100644
--- a/net/url_request/url_request_inet_job.cc
+++ b/net/url_request/url_request_inet_job.cc
@@ -141,17 +141,16 @@ void URLRequestInetJob::Kill() {
void URLRequestInetJob::SetAuth(const wstring& username,
const wstring& password) {
- DCHECK((proxy_auth_ != NULL && proxy_auth_->state == AUTH_STATE_NEED_AUTH) ||
- (server_auth_ != NULL &&
- (server_auth_->state == AUTH_STATE_NEED_AUTH)));
+ DCHECK((proxy_auth_ && proxy_auth_->state == net::AUTH_STATE_NEED_AUTH) ||
+ (server_auth_ && server_auth_->state == net::AUTH_STATE_NEED_AUTH));
// Proxy gets set first, then WWW.
- AuthData* auth =
- (proxy_auth_ != NULL && proxy_auth_->state == AUTH_STATE_NEED_AUTH ?
+ net::AuthData* auth =
+ (proxy_auth_ && proxy_auth_->state == net::AUTH_STATE_NEED_AUTH ?
proxy_auth_.get() : server_auth_.get());
if (auth) {
- auth->state = AUTH_STATE_HAVE_AUTH;
+ auth->state = net::AUTH_STATE_HAVE_AUTH;
auth->username = username;
auth->password = password;
}
@@ -165,17 +164,16 @@ void URLRequestInetJob::SetAuth(const wstring& username,
}
void URLRequestInetJob::CancelAuth() {
- DCHECK((proxy_auth_ != NULL && proxy_auth_->state == AUTH_STATE_NEED_AUTH) ||
- (server_auth_ != NULL &&
- (server_auth_->state == AUTH_STATE_NEED_AUTH)));
+ DCHECK((proxy_auth_ && proxy_auth_->state == net::AUTH_STATE_NEED_AUTH) ||
+ (server_auth_ && server_auth_->state == net::AUTH_STATE_NEED_AUTH));
// Proxy gets set first, then WWW.
- AuthData* auth =
- (proxy_auth_ != NULL && proxy_auth_->state == AUTH_STATE_NEED_AUTH ?
+ net::AuthData* auth =
+ (proxy_auth_ && proxy_auth_->state == net::AUTH_STATE_NEED_AUTH ?
proxy_auth_.get() : server_auth_.get());
if (auth) {
- auth->state = AUTH_STATE_CANCELED;
+ auth->state = net::AUTH_STATE_CANCELED;
}
// Once the auth is cancelled, we proceed with the request as though
diff --git a/net/url_request/url_request_inet_job.h b/net/url_request/url_request_inet_job.h
index a82d754..ec44689 100644
--- a/net/url_request/url_request_inet_job.h
+++ b/net/url_request/url_request_inet_job.h
@@ -36,7 +36,10 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
+namespace net {
class AuthData;
+}
+
class MessageLoop;
// For all WinInet-based URL requests
@@ -139,8 +142,8 @@ protected:
std::string extra_request_headers_;
// Authentication information.
- scoped_refptr<AuthData> proxy_auth_;
- scoped_refptr<AuthData> server_auth_;
+ scoped_refptr<net::AuthData> proxy_auth_;
+ scoped_refptr<net::AuthData> server_auth_;
private:
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index 6485489..628038f 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -299,12 +299,12 @@ void URLRequestJob::NotifyHeadersComplete() {
return;
}
} else if (NeedsAuth()) {
- scoped_refptr<AuthChallengeInfo> auth_info;
+ scoped_refptr<net::AuthChallengeInfo> auth_info;
GetAuthChallengeInfo(&auth_info);
// Need to check for a NULL auth_info because the server may have failed
// to send a challenge with the 401 response.
if (auth_info) {
- scoped_refptr<AuthData> auth_data;
+ scoped_refptr<net::AuthData> auth_data;
GetCachedAuthData(*auth_info, &auth_data);
if (auth_data) {
SetAuth(auth_data->username, auth_data->password);
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index 60a870d..9cb4a18 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -168,7 +168,7 @@ class URLRequestJob : public base::RefCounted<URLRequestJob> {
// Fills the authentication info with the server's response.
virtual void GetAuthChallengeInfo(
- scoped_refptr<AuthChallengeInfo>* auth_info) {
+ scoped_refptr<net::AuthChallengeInfo>* auth_info) {
// This will only be called if NeedsAuth() returns true, in which
// case the derived class should implement this!
NOTREACHED();
@@ -177,8 +177,8 @@ class URLRequestJob : public base::RefCounted<URLRequestJob> {
// Returns cached auth data for the auth challenge. Returns NULL if there
// is no auth cache or if the auth cache doesn't have the auth data for
// the auth challenge.
- virtual void GetCachedAuthData(const AuthChallengeInfo& auth_info,
- scoped_refptr<AuthData>* auth_data) {
+ virtual void GetCachedAuthData(const net::AuthChallengeInfo& auth_info,
+ scoped_refptr<net::AuthData>* auth_data) {
*auth_data = NULL;
}
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h
index 7e40710..0ee0043 100644
--- a/net/url_request/url_request_unittest.h
+++ b/net/url_request/url_request_unittest.h
@@ -143,7 +143,7 @@ class TestDelegate : public URLRequest::Delegate {
MessageLoop::current()->Quit();
}
- void OnAuthRequired(URLRequest* request, AuthChallengeInfo* auth_info) {
+ void OnAuthRequired(URLRequest* request, net::AuthChallengeInfo* auth_info) {
if (!username_.empty() || !password_.empty()) {
request->SetAuth(username_, password_);
} else {