diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 18:00:53 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 18:00:53 +0000 |
commit | 9349cfb12f1b27e30ebb5d4ffc994812cce26d59 (patch) | |
tree | c98a55495b06a5cd068c251d2e217cf89cef6c02 /net/url_request | |
parent | 1c77d22487ac4759f29d329be7493228671bc05f (diff) | |
download | chromium_src-9349cfb12f1b27e30ebb5d4ffc994812cce26d59.zip chromium_src-9349cfb12f1b27e30ebb5d4ffc994812cce26d59.tar.gz chromium_src-9349cfb12f1b27e30ebb5d4ffc994812cce26d59.tar.bz2 |
FBTF: A giant cleanup to net/
This moves all sorts of code from h files to cc files and reduces header
dependencies.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/3212008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request.cc | 48 | ||||
-rw-r--r-- | net/url_request/url_request.h | 29 | ||||
-rw-r--r-- | net/url_request/url_request_about_job.cc | 3 | ||||
-rw-r--r-- | net/url_request/url_request_about_job.h | 2 | ||||
-rw-r--r-- | net/url_request/url_request_context.cc | 15 | ||||
-rw-r--r-- | net/url_request/url_request_context.h | 17 | ||||
-rw-r--r-- | net/url_request/url_request_http_job.cc | 1 |
7 files changed, 81 insertions, 34 deletions
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 3ed7d92..c87d9a3 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -45,6 +45,54 @@ void StripPostSpecificHeaders(net::HttpRequestHeaders* headers) { } // namespace /////////////////////////////////////////////////////////////////////////////// +// URLRequest::Interceptor + +URLRequestJob* URLRequest::Interceptor::MaybeInterceptRedirect( + URLRequest* request, + const GURL& location) { + return NULL; +} + +URLRequestJob* URLRequest::Interceptor::MaybeInterceptResponse( + URLRequest* request) { + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// URLRequest::Delegate + +void URLRequest::Delegate::OnReceivedRedirect(URLRequest* request, + const GURL& new_url, + bool* defer_redirect) { +} + +void URLRequest::Delegate::OnAuthRequired(URLRequest* request, + net::AuthChallengeInfo* auth_info) { + request->CancelAuth(); +} + +void URLRequest::Delegate::OnCertificateRequested( + URLRequest* request, + net::SSLCertRequestInfo* cert_request_info) { + request->ContinueWithCertificate(NULL); +} + +void URLRequest::Delegate::OnSSLCertificateError(URLRequest* request, + int cert_error, + net::X509Certificate* cert) { + request->Cancel(); +} + +void URLRequest::Delegate::OnGetCookies(URLRequest* request, + bool blocked_by_policy) { +} + +void URLRequest::Delegate::OnSetCookie(URLRequest* request, + const std::string& cookie_line, + bool blocked_by_policy) { +} + +/////////////////////////////////////////////////////////////////////////////// // URLRequest URLRequest::URLRequest(const GURL& url, Delegate* delegate) diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 3f06954..31b732e 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -90,9 +90,7 @@ class URLRequest : public NonThreadSafe { // the delegate never sees the original redirect response, instead the // response produced by the intercept job will be returned. virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request, - const GURL& location) { - return NULL; - } + const GURL& location); // Called after having received a final response, but prior to the // the request delegate being informed of the response. This is also @@ -102,9 +100,7 @@ class URLRequest : public NonThreadSafe { // continue. If a new job is provided, the delegate never sees the original // response, instead the response produced by the intercept job will be // returned. - virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request) { - return NULL; - } + virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request); }; // The delegate's methods are called from the message loop of the thread @@ -152,8 +148,7 @@ class URLRequest : public NonThreadSafe { // deferring redirect. virtual void OnReceivedRedirect(URLRequest* request, const GURL& new_url, - bool* defer_redirect) { - } + bool* defer_redirect); // Called when we receive an authentication failure. The delegate should // call request->SetAuth() with the user's credentials once it obtains them, @@ -161,9 +156,7 @@ class URLRequest : public NonThreadSafe { // When it does so, the request will be reissued, restarting the sequence // of On* callbacks. virtual void OnAuthRequired(URLRequest* request, - net::AuthChallengeInfo* auth_info) { - request->CancelAuth(); - } + net::AuthChallengeInfo* auth_info); // Called when we receive an SSL CertificateRequest message for client // authentication. The delegate should call @@ -172,9 +165,7 @@ class URLRequest : public NonThreadSafe { // handshake without a client certificate. virtual void OnCertificateRequested( URLRequest* request, - net::SSLCertRequestInfo* cert_request_info) { - request->ContinueWithCertificate(NULL); - } + net::SSLCertRequestInfo* cert_request_info); // Called when using SSL and the server responds with a certificate with // an error, for example, whose common name does not match the common name @@ -184,23 +175,19 @@ class URLRequest : public NonThreadSafe { // indicating what's wrong with the certificate. virtual void OnSSLCertificateError(URLRequest* request, int cert_error, - net::X509Certificate* cert) { - request->Cancel(); - } + net::X509Certificate* cert); // Called when reading cookies. |blocked_by_policy| is true if access to // cookies was denied due to content settings. This method will never be // invoked when LOAD_DO_NOT_SEND_COOKIES is specified. - virtual void OnGetCookies(URLRequest* request, bool blocked_by_policy) { - } + virtual void OnGetCookies(URLRequest* request, bool blocked_by_policy); // Called when a cookie is set. |blocked_by_policy| is true if the cookie // was rejected due to content settings. This method will never be invoked // when LOAD_DO_NOT_SAVE_COOKIES is specified. virtual void OnSetCookie(URLRequest* request, const std::string& cookie_line, - bool blocked_by_policy) { - } + bool blocked_by_policy); // After calling Start(), the delegate will receive an OnResponseStarted // callback when the request has completed. If an error occurred, the diff --git a/net/url_request/url_request_about_job.cc b/net/url_request/url_request_about_job.cc index 917abf9..ac6aa01 100644 --- a/net/url_request/url_request_about_job.cc +++ b/net/url_request/url_request_about_job.cc @@ -32,6 +32,9 @@ bool URLRequestAboutJob::GetMimeType(std::string* mime_type) const { return true; } +URLRequestAboutJob::~URLRequestAboutJob() { +} + void URLRequestAboutJob::StartAsync() { NotifyHeadersComplete(); } diff --git a/net/url_request/url_request_about_job.h b/net/url_request/url_request_about_job.h index f31ba0a..52a659e 100644 --- a/net/url_request/url_request_about_job.h +++ b/net/url_request/url_request_about_job.h @@ -21,7 +21,7 @@ class URLRequestAboutJob : public URLRequestJob { static URLRequest::ProtocolFactory Factory; private: - ~URLRequestAboutJob() {} + ~URLRequestAboutJob(); void StartAsync(); }; diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc index b39843a..0ea8477 100644 --- a/net/url_request/url_request_context.cc +++ b/net/url_request/url_request_context.cc @@ -5,7 +5,22 @@ #include "net/url_request/url_request_context.h" #include "base/string_util.h" +#include "net/base/cookie_store.h" +#include "net/base/host_resolver.h" + +URLRequestContext::URLRequestContext() + : net_log_(NULL), + http_transaction_factory_(NULL), + ftp_transaction_factory_(NULL), + http_auth_handler_factory_(NULL), + network_delegate_(NULL), + cookie_policy_(NULL), + transport_security_state_(NULL) { +} const std::string& URLRequestContext::GetUserAgent(const GURL& url) const { return EmptyString(); } + +URLRequestContext::~URLRequestContext() { +} diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index e72d27f..6ddc940 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -13,8 +13,6 @@ #include "base/non_thread_safe.h" #include "base/ref_counted.h" -#include "net/base/cookie_store.h" -#include "net/base/host_resolver.h" #include "net/base/net_log.h" #include "net/base/ssl_config_service.h" #include "net/base/transport_security_state.h" @@ -23,10 +21,13 @@ namespace net { class CookiePolicy; +class CookieStore; class FtpTransactionFactory; +class HostResolver; class HttpAuthHandlerFactory; class HttpNetworkDelegate; class HttpTransactionFactory; +class SSLConfigService; } class URLRequest; @@ -35,15 +36,7 @@ class URLRequestContext : public base::RefCountedThreadSafe<URLRequestContext>, public NonThreadSafe { public: - URLRequestContext() - : net_log_(NULL), - http_transaction_factory_(NULL), - ftp_transaction_factory_(NULL), - http_auth_handler_factory_(NULL), - network_delegate_(NULL), - cookie_policy_(NULL), - transport_security_state_(NULL) { - } + URLRequestContext(); net::NetLog* net_log() const { return net_log_; @@ -114,7 +107,7 @@ class URLRequestContext protected: friend class base::RefCountedThreadSafe<URLRequestContext>; - virtual ~URLRequestContext() {} + virtual ~URLRequestContext(); // The following members are expected to be initialized and owned by // subclasses. diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index cbccff2..11df1d0 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -14,6 +14,7 @@ #include "base/string_util.h" #include "net/base/cert_status_flags.h" #include "net/base/cookie_policy.h" +#include "net/base/cookie_store.h" #include "net/base/filter.h" #include "net/base/transport_security_state.h" #include "net/base/load_flags.h" |