diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 16:40:10 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 16:40:10 +0000 |
commit | a9bb6f69b32018c245e05a79011114653fe8f5e0 (patch) | |
tree | c4fe6b5db0e508f860c82feb44245bf549d608ff /net/url_request | |
parent | f23423a1245dffc2a368708fafd2867d2cf3e0f8 (diff) | |
download | chromium_src-a9bb6f69b32018c245e05a79011114653fe8f5e0.zip chromium_src-a9bb6f69b32018c245e05a79011114653fe8f5e0.tar.gz chromium_src-a9bb6f69b32018c245e05a79011114653fe8f5e0.tar.bz2 |
Move some more classes from net/base into the net:: namespace.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/mime_sniffer_proxy.cc | 6 | ||||
-rw-r--r-- | net/url_request/mime_sniffer_proxy.h | 2 | ||||
-rw-r--r-- | net/url_request/url_request.h | 2 | ||||
-rw-r--r-- | net/url_request/url_request_context.h | 4 | ||||
-rw-r--r-- | net/url_request/url_request_file_dir_job.cc | 2 | ||||
-rw-r--r-- | net/url_request/url_request_file_dir_job.h | 4 | ||||
-rw-r--r-- | net/url_request/url_request_file_job.cc | 2 | ||||
-rw-r--r-- | net/url_request/url_request_ftp_job.cc | 21 | ||||
-rw-r--r-- | net/url_request/url_request_ftp_job.h | 6 | ||||
-rw-r--r-- | net/url_request/url_request_http_cache_job.cc | 44 | ||||
-rw-r--r-- | net/url_request/url_request_http_cache_job.h | 10 | ||||
-rw-r--r-- | net/url_request/url_request_inet_job.cc | 22 | ||||
-rw-r--r-- | net/url_request/url_request_inet_job.h | 7 | ||||
-rw-r--r-- | net/url_request/url_request_job.cc | 4 | ||||
-rw-r--r-- | net/url_request/url_request_job.h | 6 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.h | 2 |
16 files changed, 72 insertions, 72 deletions
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 { |