diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 21:34:02 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 21:34:02 +0000 |
commit | 6981d96328621a75557dbf843c5aab83bf4f55a3 (patch) | |
tree | 8a95daea7aad9b8bce1ced62fda4068ed296125a /net/url_request | |
parent | d4e04a67c7f529bc8137c2dc5618e5a8c2123a13 (diff) | |
download | chromium_src-6981d96328621a75557dbf843c5aab83bf4f55a3.zip chromium_src-6981d96328621a75557dbf843c5aab83bf4f55a3.tar.gz chromium_src-6981d96328621a75557dbf843c5aab83bf4f55a3.tar.bz2 |
net: Remove typedef net::URLRequest URLRequest;
BUG=64263
TEST=compiled locally, trybots
Review URL: http://codereview.chromium.org/5384002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
27 files changed, 200 insertions, 184 deletions
diff --git a/net/url_request/https_prober.cc b/net/url_request/https_prober.cc index d69eaf3..4388294 100644 --- a/net/url_request/https_prober.cc +++ b/net/url_request/https_prober.cc @@ -34,21 +34,21 @@ bool HTTPSProber::ProbeHost(const std::string& host, URLRequestContext* ctx, GURL url("https://" + host); DCHECK_EQ(url.host(), host); - URLRequest* req = new URLRequest(url, this); + net::URLRequest* req = new net::URLRequest(url, this); req->set_context(ctx); req->Start(); return true; } -void HTTPSProber::Success(URLRequest* request) { +void HTTPSProber::Success(net::URLRequest* request) { DoCallback(request, true); } -void HTTPSProber::Failure(URLRequest* request) { +void HTTPSProber::Failure(net::URLRequest* request) { DoCallback(request, false); } -void HTTPSProber::DoCallback(URLRequest* request, bool result) { +void HTTPSProber::DoCallback(net::URLRequest* request, bool result) { std::map<std::string, HTTPSProberDelegate*>::iterator i = inflight_probes_.find(request->original_url().host()); DCHECK(i != inflight_probes_.end()); @@ -60,18 +60,18 @@ void HTTPSProber::DoCallback(URLRequest* request, bool result) { delegate->ProbeComplete(result); } -void HTTPSProber::OnAuthRequired(URLRequest* request, +void HTTPSProber::OnAuthRequired(net::URLRequest* request, net::AuthChallengeInfo* auth_info) { Success(request); } -void HTTPSProber::OnSSLCertificateError(URLRequest* request, +void HTTPSProber::OnSSLCertificateError(net::URLRequest* request, int cert_error, net::X509Certificate* cert) { request->ContinueDespiteLastError(); } -void HTTPSProber::OnResponseStarted(URLRequest* request) { +void HTTPSProber::OnResponseStarted(net::URLRequest* request) { if (request->status().status() == URLRequestStatus::SUCCESS) { Success(request); } else { @@ -79,7 +79,7 @@ void HTTPSProber::OnResponseStarted(URLRequest* request) { } } -void HTTPSProber::OnReadCompleted(URLRequest* request, int bytes_read) { +void HTTPSProber::OnReadCompleted(net::URLRequest* request, int bytes_read) { NOTREACHED(); } diff --git a/net/url_request/https_prober.h b/net/url_request/https_prober.h index 28182c4..ab70fd3 100644 --- a/net/url_request/https_prober.h +++ b/net/url_request/https_prober.h @@ -20,7 +20,7 @@ namespace net { // This should be scoped inside HTTPSProber, but VC cannot compile // HTTPProber::Delegate when HTTPSProber also inherits from -// URLRequest::Delegate. +// net::URLRequest::Delegate. class HTTPSProberDelegate { public: virtual void ProbeComplete(bool result) = 0; @@ -31,7 +31,7 @@ class HTTPSProberDelegate { // HTTPSProber is a singleton object that manages HTTPS probes. A HTTPS probe // determines if we can connect to a given host over HTTPS. It's used when // transparently upgrading from HTTP to HTTPS (for example, for SPDY). -class HTTPSProber : public URLRequest::Delegate { +class HTTPSProber : public net::URLRequest::Delegate { public: HTTPSProber(); ~HTTPSProber(); @@ -52,19 +52,19 @@ class HTTPSProber : public URLRequest::Delegate { bool ProbeHost(const std::string& host, URLRequestContext* ctx, HTTPSProberDelegate* delegate); - // Implementation of URLRequest::Delegate - void OnAuthRequired(URLRequest* request, + // Implementation of net::URLRequest::Delegate + void OnAuthRequired(net::URLRequest* request, net::AuthChallengeInfo* auth_info); - void OnSSLCertificateError(URLRequest* request, + void OnSSLCertificateError(net::URLRequest* request, int cert_error, net::X509Certificate* cert); - void OnResponseStarted(URLRequest* request); - void OnReadCompleted(URLRequest* request, int bytes_read); + void OnResponseStarted(net::URLRequest* request); + void OnReadCompleted(net::URLRequest* request, int bytes_read); private: - void Success(URLRequest* request); - void Failure(URLRequest* request); - void DoCallback(URLRequest* request, bool result); + void Success(net::URLRequest* request); + void Failure(net::URLRequest* request); + void DoCallback(net::URLRequest* request, bool result); std::map<std::string, HTTPSProberDelegate*> inflight_probes_; std::set<std::string> probed_; diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index ac54a1f..b71e764 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -44,6 +44,8 @@ void StripPostSpecificHeaders(net::HttpRequestHeaders* headers) { } // namespace +namespace net { + /////////////////////////////////////////////////////////////////////////////// // URLRequest::Interceptor @@ -598,3 +600,5 @@ URLRequest::UserData* URLRequest::GetUserData(const void* key) const { void URLRequest::SetUserData(const void* key, UserData* data) { user_data_[key] = linked_ptr<UserData>(data); } + +} // namespace net diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index fb81500..ffd4f88 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -646,6 +646,4 @@ class URLRequest : public NonThreadSafe { } // namespace net -typedef net::URLRequest URLRequest; - #endif // NET_URL_REQUEST_URL_REQUEST_H_ diff --git a/net/url_request/url_request_about_job.cc b/net/url_request/url_request_about_job.cc index ac6aa01..145093e 100644 --- a/net/url_request/url_request_about_job.cc +++ b/net/url_request/url_request_about_job.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,12 +11,12 @@ #include "base/message_loop.h" // static -URLRequestJob* URLRequestAboutJob::Factory(URLRequest* request, +URLRequestJob* URLRequestAboutJob::Factory(net::URLRequest* request, const std::string& scheme) { return new URLRequestAboutJob(request); } -URLRequestAboutJob::URLRequestAboutJob(URLRequest* request) +URLRequestAboutJob::URLRequestAboutJob(net::URLRequest* request) : URLRequestJob(request) { } diff --git a/net/url_request/url_request_about_job.h b/net/url_request/url_request_about_job.h index 52a659e..65f1f61 100644 --- a/net/url_request/url_request_about_job.h +++ b/net/url_request/url_request_about_job.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,12 +13,12 @@ class URLRequestAboutJob : public URLRequestJob { public: - explicit URLRequestAboutJob(URLRequest* request); + explicit URLRequestAboutJob(net::URLRequest* request); virtual void Start(); virtual bool GetMimeType(std::string* mime_type) const; - static URLRequest::ProtocolFactory Factory; + static net::URLRequest::ProtocolFactory Factory; private: ~URLRequestAboutJob(); diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 38692ad..f8a6c7d 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -34,7 +34,8 @@ class SSLConfigService; class URLRequest; } // namespace net -// Subclass to provide application-specific context for URLRequest instances. +// Subclass to provide application-specific context for net::URLRequest +// instances. class URLRequestContext : public base::RefCountedThreadSafe<URLRequestContext>, public NonThreadSafe { diff --git a/net/url_request/url_request_data_job.cc b/net/url_request/url_request_data_job.cc index 737f169..3d9dace 100644 --- a/net/url_request/url_request_data_job.cc +++ b/net/url_request/url_request_data_job.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,12 +10,12 @@ #include "net/url_request/url_request.h" // static -URLRequestJob* URLRequestDataJob::Factory(URLRequest* request, +URLRequestJob* URLRequestDataJob::Factory(net::URLRequest* request, const std::string& scheme) { return new URLRequestDataJob(request); } -URLRequestDataJob::URLRequestDataJob(URLRequest* request) +URLRequestDataJob::URLRequestDataJob(net::URLRequest* request) : URLRequestSimpleJob(request) { } diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc index 23ff6ff..968b404 100644 --- a/net/url_request/url_request_file_dir_job.cc +++ b/net/url_request/url_request_file_dir_job.cc @@ -20,7 +20,7 @@ using std::string; -URLRequestFileDirJob::URLRequestFileDirJob(URLRequest* request, +URLRequestFileDirJob::URLRequestFileDirJob(net::URLRequest* request, const FilePath& dir_path) : URLRequestJob(request), dir_path_(dir_path), @@ -62,9 +62,9 @@ void URLRequestFileDirJob::Kill() { canceled_ = true; - // Don't call CloseLister or dispatch an error to the URLRequest because we - // want OnListDone to be called to also write the error to the output stream. - // OnListDone will notify the URLRequest at this time. + // Don't call CloseLister or dispatch an error to the net::URLRequest because + // we want OnListDone to be called to also write the error to the output + // stream. OnListDone will notify the net::URLRequest at this time. if (lister_) lister_->Cancel(); diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index 526dabf..7256909 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -83,8 +83,8 @@ class URLRequestFileJob::AsyncResolver #endif // static -URLRequestJob* URLRequestFileJob::Factory( - URLRequest* request, const std::string& scheme) { +URLRequestJob* URLRequestFileJob::Factory(net::URLRequest* request, + const std::string& scheme) { FilePath file_path; const bool is_file = net::FileURLToFilePath(request->url(), &file_path); @@ -111,7 +111,7 @@ URLRequestJob* URLRequestFileJob::Factory( return new URLRequestFileJob(request, file_path); } -URLRequestFileJob::URLRequestFileJob(URLRequest* request, +URLRequestFileJob::URLRequestFileJob(net::URLRequest* request, const FilePath& file_path) : URLRequestJob(request), file_path_(file_path), @@ -367,7 +367,7 @@ static const char* const kLocalAccessWhiteList[] = { // static bool URLRequestFileJob::AccessDisabled(const FilePath& file_path) { - if (URLRequest::IsFileAccessAllowed()) { // for tests. + if (net::URLRequest::IsFileAccessAllowed()) { // for tests. return false; } diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h index e745cfd..0e7cf38 100644 --- a/net/url_request/url_request_file_job.h +++ b/net/url_request/url_request_file_job.h @@ -23,7 +23,7 @@ struct FileInfo; // A request job that handles reading file URLs class URLRequestFileJob : public URLRequestJob { public: - URLRequestFileJob(URLRequest* request, const FilePath& file_path); + URLRequestFileJob(net::URLRequest* request, const FilePath& file_path); virtual void Start(); virtual void Kill(); @@ -34,7 +34,7 @@ class URLRequestFileJob : public URLRequestJob { virtual bool GetMimeType(std::string* mime_type) const; virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); - static URLRequest::ProtocolFactory Factory; + static net::URLRequest::ProtocolFactory Factory; #if defined(OS_CHROMEOS) static bool AccessDisabled(const FilePath& file_path); diff --git a/net/url_request/url_request_filter.cc b/net/url_request/url_request_filter.cc index fb305b2..946c2c3 100644 --- a/net/url_request/url_request_filter.cc +++ b/net/url_request/url_request_filter.cc @@ -27,12 +27,12 @@ net::URLRequestJob* URLRequestFilter::Factory(net::URLRequest* request, URLRequestFilter::~URLRequestFilter() {} void URLRequestFilter::AddHostnameHandler(const std::string& scheme, - const std::string& hostname, URLRequest::ProtocolFactory* factory) { + const std::string& hostname, net::URLRequest::ProtocolFactory* factory) { hostname_handler_map_[make_pair(scheme, hostname)] = factory; // Register with the ProtocolFactory. - URLRequest::RegisterProtocolFactory(scheme, - &URLRequestFilter::Factory); + net::URLRequest::RegisterProtocolFactory(scheme, + &URLRequestFilter::Factory); #ifndef NDEBUG // Check to see if we're masking URLs in the url_handler_map_. @@ -54,20 +54,22 @@ void URLRequestFilter::RemoveHostnameHandler(const std::string& scheme, DCHECK(iter != hostname_handler_map_.end()); hostname_handler_map_.erase(iter); - // Note that we don't unregister from the URLRequest ProtocolFactory as this - // would left no protocol factory for the scheme. URLRequestFilter::Factory - // will keep forwarding the requests to the URLRequestInetJob. + // Note that we don't unregister from the net::URLRequest ProtocolFactory as + // this would left no protocol factory for the scheme. + // URLRequestFilter::Factory will keep forwarding the requests to the + // URLRequestInetJob. } -bool URLRequestFilter::AddUrlHandler(const GURL& url, - URLRequest::ProtocolFactory* factory) { +bool URLRequestFilter::AddUrlHandler( + const GURL& url, + net::URLRequest::ProtocolFactory* factory) { if (!url.is_valid()) return false; url_handler_map_[url.spec()] = factory; // Register with the ProtocolFactory. - URLRequest::RegisterProtocolFactory(url.scheme(), - &URLRequestFilter::Factory); + net::URLRequest::RegisterProtocolFactory(url.scheme(), + &URLRequestFilter::Factory); #ifndef NDEBUG // Check to see if this URL is masked by a hostname handler. HostnameHandlerMap::iterator host_it = @@ -84,9 +86,10 @@ void URLRequestFilter::RemoveUrlHandler(const GURL& url) { DCHECK(iter != url_handler_map_.end()); url_handler_map_.erase(iter); - // Note that we don't unregister from the URLRequest ProtocolFactory as this - // would left no protocol factory for the scheme. URLRequestFilter::Factory - // will keep forwarding the requests to the URLRequestInetJob. + // Note that we don't unregister from the net::URLRequest ProtocolFactory as + // this would left no protocol factory for the scheme. + // URLRequestFilter::Factory will keep forwarding the requests to the + // URLRequestInetJob. } void URLRequestFilter::ClearHandlers() { @@ -102,7 +105,7 @@ void URLRequestFilter::ClearHandlers() { } for (std::set<std::string>::const_iterator scheme = schemes.begin(); scheme != schemes.end(); ++scheme) { - URLRequest::RegisterProtocolFactory(*scheme, NULL); + net::URLRequest::RegisterProtocolFactory(*scheme, NULL); } url_handler_map_.clear(); diff --git a/net/url_request/url_request_filter.h b/net/url_request/url_request_filter.h index c3021cb..716ad4d 100644 --- a/net/url_request/url_request_filter.h +++ b/net/url_request/url_request_filter.h @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// A class to help filter URLRequest jobs based on the URL of the request +// A class to help filter net::URLRequest jobs based on the URL of the request // rather than just the scheme. Example usage: // // // Use as an "http" handler. -// URLRequest::RegisterProtocolFactory("http", &URLRequestFilter::Factory); +// net::URLRequest::RegisterProtocolFactory("http", &URLRequestFilter::Factory); // // Add special handling for the URL http://foo.com/ // URLRequestFilter::GetInstance()->AddUrlHandler( // GURL("http://foo.com/"), @@ -36,26 +36,27 @@ class URLRequestFilter { public: // scheme,hostname -> ProtocolFactory typedef std::map<std::pair<std::string, std::string>, - URLRequest::ProtocolFactory*> HostnameHandlerMap; - typedef base::hash_map<std::string, URLRequest::ProtocolFactory*> + net::URLRequest::ProtocolFactory*> HostnameHandlerMap; + typedef base::hash_map<std::string, net::URLRequest::ProtocolFactory*> UrlHandlerMap; // Singleton instance for use. static URLRequestFilter* GetInstance(); - static URLRequest::ProtocolFactory Factory; + static net::URLRequest::ProtocolFactory Factory; ~URLRequestFilter(); void AddHostnameHandler(const std::string& scheme, const std::string& hostname, - URLRequest::ProtocolFactory* factory); + net::URLRequest::ProtocolFactory* factory); void RemoveHostnameHandler(const std::string& scheme, const std::string& hostname); // Returns true if we successfully added the URL handler. This will replace // old handlers for the URL if one existed. - bool AddUrlHandler(const GURL& url, URLRequest::ProtocolFactory* factory); + bool AddUrlHandler(const GURL& url, + net::URLRequest::ProtocolFactory* factory); void RemoveUrlHandler(const GURL& url); @@ -70,7 +71,7 @@ class URLRequestFilter { URLRequestFilter(); // Helper method that looks up the request in the url_handler_map_. - net::URLRequestJob* FindRequestHandler(URLRequest* request, + net::URLRequestJob* FindRequestHandler(net::URLRequest* request, const std::string& scheme); // Maps hostnames to factories. Hostnames take priority over URLs. diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc index aec8248..c60275b 100644 --- a/net/url_request/url_request_ftp_job.cc +++ b/net/url_request/url_request_ftp_job.cc @@ -16,7 +16,7 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_error_job.h" -URLRequestFtpJob::URLRequestFtpJob(URLRequest* request) +URLRequestFtpJob::URLRequestFtpJob(net::URLRequest* request) : URLRequestJob(request), ALLOW_THIS_IN_INITIALIZER_LIST( start_callback_(this, &URLRequestFtpJob::OnStartCompleted)), @@ -30,7 +30,7 @@ URLRequestFtpJob::~URLRequestFtpJob() { } // static -URLRequestJob* URLRequestFtpJob::Factory(URLRequest* request, +URLRequestJob* URLRequestFtpJob::Factory(net::URLRequest* request, const std::string& scheme) { DCHECK_EQ(scheme, "ftp"); @@ -233,7 +233,7 @@ void URLRequestFtpJob::StartTransaction() { rv = net::ERR_FAILED; } // The transaction started synchronously, but we need to notify the - // URLRequest delegate via the message loop. + // net::URLRequest delegate via the message loop. MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( this, &URLRequestFtpJob::OnStartCompleted, rv)); } diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index bbb229b..70e43fe 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -40,7 +40,7 @@ static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; // TODO(darin): make sure the port blocking code is not lost // static -URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, +URLRequestJob* URLRequestHttpJob::Factory(net::URLRequest* request, const std::string& scheme) { DCHECK(scheme == "http" || scheme == "https"); @@ -77,7 +77,7 @@ URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, return new URLRequestHttpJob(request); } -URLRequestHttpJob::URLRequestHttpJob(URLRequest* request) +URLRequestHttpJob::URLRequestHttpJob(net::URLRequest* request) : URLRequestJob(request), response_info_(NULL), response_cookies_save_index_(0), @@ -261,7 +261,7 @@ bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { // restrict redirects to externally handled protocols. Our consumer would // need to take care of those. - if (!URLRequest::IsHandledURL(location)) + if (!net::URLRequest::IsHandledURL(location)) return true; static const char* kSafeSchemes[] = { @@ -388,7 +388,7 @@ void URLRequestHttpJob::ContinueWithCertificate( return; // The transaction started synchronously, but we need to notify the - // URLRequest delegate via the message loop. + // net::URLRequest delegate via the message loop. MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( this, &URLRequestHttpJob::OnStartCompleted, rv)); } @@ -409,7 +409,7 @@ void URLRequestHttpJob::ContinueDespiteLastError() { return; // The transaction started synchronously, but we need to notify the - // URLRequest delegate via the message loop. + // net::URLRequest delegate via the message loop. MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( this, &URLRequestHttpJob::OnStartCompleted, rv)); } @@ -659,7 +659,7 @@ void URLRequestHttpJob::StartTransaction() { return; // The transaction started synchronously, but we need to notify the - // URLRequest delegate via the message loop. + // net::URLRequest delegate via the message loop. MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( this, &URLRequestHttpJob::OnStartCompleted, rv)); } diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index a059a00..1b56b50 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -25,6 +25,8 @@ using base::TimeTicks; // static const int URLRequestJob::kFilterBufSize = 32 * 1024; +namespace net { + URLRequestJob::URLRequestJob(URLRequest* request) : request_(request), prefilter_bytes_read_(0), @@ -443,7 +445,7 @@ void URLRequestJob::NotifyHeadersComplete() { // Initialize to the current time, and let the subclass optionally override // the time stamps if it has that information. The default request_time is - // set by URLRequest before it calls our Start method. + // set by net::URLRequest before it calls our Start method. request_->response_info_.response_time = Time::Now(); GetResponseInfo(&request_->response_info_); @@ -930,3 +932,5 @@ void URLRequestJob::RecordCompressionHistograms() { COMPRESSION_HISTOGRAM("NoProxy.ShouldHaveBeenCompressed", decompressed_B); } } + +} // namespace net diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 239f5e9..ab54354 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h @@ -65,9 +65,9 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>, // This function MUST somehow call NotifyDone/NotifyCanceled or some requests // will get leaked. Certain callers use that message to know when they can - // delete their URLRequest object, even when doing a cancel. The default Kill - // implementation calls NotifyCanceled, so it is recommended that subclasses - // call URLRequestJob::Kill() after doing any additional work. + // delete their net::URLRequest object, even when doing a cancel. The default + // Kill implementation calls NotifyCanceled, so it is recommended that + // subclasses call URLRequestJob::Kill() after doing any additional work. // // The job should endeavor to stop working as soon as is convenient, but must // not send and complete notifications from inside this function. Instead, @@ -90,12 +90,12 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>, // Called to read post-filtered data from this Job, returning the number of // bytes read, 0 when there is no more data, or -1 if there was an error. - // This is just the backend for URLRequest::Read, see that function for more - // info. + // This is just the backend for net::URLRequest::Read, see that function for + // more info. bool Read(net::IOBuffer* buf, int buf_size, int* bytes_read); // Stops further caching of this request, if any. For more info, see - // URLRequest::StopCaching(). + // net::URLRequest::StopCaching(). virtual void StopCaching(); // Called to fetch the current load state for the job. @@ -157,8 +157,8 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>, // Called to determine if it is okay to redirect this job to the specified // location. This may be used to implement protocol-specific restrictions. - // If this function returns false, then the URLRequest will fail reporting - // net::ERR_UNSAFE_REDIRECT. + // If this function returns false, then the net::URLRequest will fail + // reporting net::ERR_UNSAFE_REDIRECT. virtual bool IsSafeRedirect(const GURL& location); // Called to determine if this response is asking for authentication. Only @@ -240,8 +240,8 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>, // that work. void CompleteNotifyDone(); - // Used as an asynchronous callback for Kill to notify the URLRequest that - // we were canceled. + // Used as an asynchronous callback for Kill to notify the net::URLRequest + // that we were canceled. void NotifyCanceled(); // Notifies the job the request should be restarted. @@ -256,7 +256,8 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>, // If returning false, an error occurred or an async IO is now pending. // If async IO is pending, the status of the request will be // URLRequestStatus::IO_PENDING, and buf must remain available until the - // operation is completed. See comments on URLRequest::Read for more info. + // operation is completed. See comments on net::URLRequest::Read for more + // info. virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read); // Informs the filter that data has been read into its buffer @@ -298,9 +299,10 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>, int prefilter_bytes_read_; // The number of bytes read after passing through the filter. int postfilter_bytes_read_; - // True when (we believe) the content in this URLRequest was compressible. + // True when (we believe) the content in this net::URLRequest was + // compressible. bool is_compressible_content_; - // True when the content in this URLRequest was compressed. + // True when the content in this net::URLRequest was compressed. bool is_compressed_; private: diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc index e8a4820..1bc0be1 100644 --- a/net/url_request/url_request_job_manager.cc +++ b/net/url_request/url_request_job_manager.cc @@ -22,7 +22,7 @@ namespace { struct SchemeToFactory { const char* scheme; - URLRequest::ProtocolFactory* factory; + net::URLRequest::ProtocolFactory* factory; }; } // namespace @@ -45,7 +45,7 @@ URLRequestJobManager::URLRequestJobManager() : enable_file_access_(false) { URLRequestJobManager::~URLRequestJobManager() {} -URLRequestJob* URLRequestJobManager::CreateJob(URLRequest* request) const { +URLRequestJob* URLRequestJobManager::CreateJob(net::URLRequest* request) const { #ifndef NDEBUG DCHECK(IsAllowedThread()); #endif @@ -100,8 +100,8 @@ URLRequestJob* URLRequestJobManager::CreateJob(URLRequest* request) const { } URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect( - URLRequest* request, - const GURL& location) const { + net::URLRequest* request, + const GURL& location) const { #ifndef NDEBUG DCHECK(IsAllowedThread()); #endif @@ -121,7 +121,7 @@ URLRequestJob* URLRequestJobManager::MaybeInterceptRedirect( } URLRequestJob* URLRequestJobManager::MaybeInterceptResponse( - URLRequest* request) const { + net::URLRequest* request) const { #ifndef NDEBUG DCHECK(IsAllowedThread()); #endif @@ -155,16 +155,16 @@ bool URLRequestJobManager::SupportsScheme(const std::string& scheme) const { return false; } -URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory( +net::URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory( const std::string& scheme, - URLRequest::ProtocolFactory* factory) { + net::URLRequest::ProtocolFactory* factory) { #ifndef NDEBUG DCHECK(IsAllowedThread()); #endif AutoLock locked(lock_); - URLRequest::ProtocolFactory* old_factory; + net::URLRequest::ProtocolFactory* old_factory; FactoryMap::iterator i = factories_.find(scheme); if (i != factories_.end()) { old_factory = i->second; @@ -180,7 +180,7 @@ URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory( } void URLRequestJobManager::RegisterRequestInterceptor( - URLRequest::Interceptor* interceptor) { + net::URLRequest::Interceptor* interceptor) { #ifndef NDEBUG DCHECK(IsAllowedThread()); #endif @@ -193,7 +193,7 @@ void URLRequestJobManager::RegisterRequestInterceptor( } void URLRequestJobManager::UnregisterRequestInterceptor( - URLRequest::Interceptor* interceptor) { + net::URLRequest::Interceptor* interceptor) { #ifndef NDEBUG DCHECK(IsAllowedThread()); #endif diff --git a/net/url_request/url_request_job_manager.h b/net/url_request/url_request_job_manager.h index 0fbc31e..6d2421a 100644 --- a/net/url_request/url_request_job_manager.h +++ b/net/url_request/url_request_job_manager.h @@ -16,14 +16,14 @@ // This class is responsible for managing the set of protocol factories and // request interceptors that determine how an URLRequestJob gets created to -// handle an URLRequest. +// handle an net::URLRequest. // // MULTI-THREADING NOTICE: -// URLRequest is designed to have all consumers on a single thread, and so no -// attempt is made to support ProtocolFactory or Interceptor instances being -// registered/unregistered or in any way poked on multiple threads. However, -// we do support checking for supported schemes FROM ANY THREAD (i.e., it is -// safe to call SupportsScheme on any thread). +// net::URLRequest is designed to have all consumers on a single thread, and +// so no attempt is made to support ProtocolFactory or Interceptor instances +// being registered/unregistered or in any way poked on multiple threads. +// However, we do support checking for supported schemes FROM ANY THREAD +// (i.e., it is safe to call SupportsScheme on any thread). // class URLRequestJobManager { public: @@ -54,19 +54,19 @@ class URLRequestJobManager { // Register a protocol factory associated with the given scheme. The factory // parameter may be null to clear any existing association. Returns the // previously registered protocol factory if any. - URLRequest::ProtocolFactory* RegisterProtocolFactory( - const std::string& scheme, URLRequest::ProtocolFactory* factory); + net::URLRequest::ProtocolFactory* RegisterProtocolFactory( + const std::string& scheme, net::URLRequest::ProtocolFactory* factory); // Register/unregister a request interceptor. - void RegisterRequestInterceptor(URLRequest::Interceptor* interceptor); - void UnregisterRequestInterceptor(URLRequest::Interceptor* interceptor); + void RegisterRequestInterceptor(net::URLRequest::Interceptor* interceptor); + void UnregisterRequestInterceptor(net::URLRequest::Interceptor* interceptor); void set_enable_file_access(bool enable) { enable_file_access_ = enable; } bool enable_file_access() const { return enable_file_access_; } private: - typedef std::map<std::string, URLRequest::ProtocolFactory*> FactoryMap; - typedef std::vector<URLRequest::Interceptor*> InterceptorList; + typedef std::map<std::string, net::URLRequest::ProtocolFactory*> FactoryMap; + typedef std::vector<net::URLRequest::Interceptor*> InterceptorList; mutable Lock lock_; FactoryMap factories_; diff --git a/net/url_request/url_request_job_tracker.cc b/net/url_request/url_request_job_tracker.cc index e3e5d36..f7ef904 100644 --- a/net/url_request/url_request_job_tracker.cc +++ b/net/url_request/url_request_job_tracker.cc @@ -17,8 +17,8 @@ URLRequestJobTracker::URLRequestJobTracker() { URLRequestJobTracker::~URLRequestJobTracker() { DLOG_IF(WARNING, active_jobs_.size() != 0) << "Leaking " << active_jobs_.size() << " URLRequestJob object(s), this could " - "be because the URLRequest forgot to free it (bad), or if the program was " - "terminated while a request was active (normal)."; + "be because the net::URLRequest forgot to free it (bad), or if the program " + "was terminated while a request was active (normal)."; } void URLRequestJobTracker::AddNewJob(URLRequestJob* job) { diff --git a/net/url_request/url_request_job_tracker.h b/net/url_request/url_request_job_tracker.h index cd0bd86..560a0b1 100644 --- a/net/url_request/url_request_job_tracker.h +++ b/net/url_request/url_request_job_tracker.h @@ -21,8 +21,9 @@ class GURL; // This allows us to warn on leaked jobs and also allows an observer to track // what is happening, for example, for the network status monitor. // -// NOTE: URLRequest is single-threaded, so this class should only be used on -// the same thread where all of the application's URLRequest calls are made. +// NOTE: net::URLRequest is single-threaded, so this class should only be used +// onthe same thread where all of the application's net::URLRequest calls are +// made. // class URLRequestJobTracker { public: @@ -62,7 +63,7 @@ class URLRequestJobTracker { ~URLRequestJobTracker(); // adds or removes an observer from the list. note, these methods should - // only be called on the same thread where URLRequest objects are used. + // only be called on the same thread where net::URLRequest objects are used. void AddObserver(JobObserver* observer) { observers_.AddObserver(observer); } diff --git a/net/url_request/url_request_job_tracker_unittest.cc b/net/url_request/url_request_job_tracker_unittest.cc index 3ddbcc2..21b72c6 100644 --- a/net/url_request/url_request_job_tracker_unittest.cc +++ b/net/url_request/url_request_job_tracker_unittest.cc @@ -70,7 +70,7 @@ class MockJobObserver : public URLRequestJobTracker::JobObserver { // async reads, in order to exercise the real async read codepath. class URLRequestJobTrackerTestJob : public URLRequestJob { public: - URLRequestJobTrackerTestJob(URLRequest* request, bool async_reads) + URLRequestJobTrackerTestJob(net::URLRequest* request, bool async_reads) : URLRequestJob(request), async_reads_(async_reads) {} void Start() { @@ -151,7 +151,7 @@ MATCHER_P2(MemEq, other, len, "") { class URLRequestJobTrackerTest : public PlatformTest { protected: static void SetUpTestCase() { - URLRequest::RegisterProtocolFactory("test", &Factory); + net::URLRequest::RegisterProtocolFactory("test", &Factory); } virtual void SetUp() { @@ -184,7 +184,7 @@ class URLRequestJobTrackerTest : public PlatformTest { void Fetch(const GURL& url) { TestDelegate d; { - URLRequest request(url, &d); + net::URLRequest request(url, &d); request.Start(); MessageLoop::current()->RunAllPending(); } @@ -196,12 +196,12 @@ class URLRequestJobTrackerTest : public PlatformTest { EXPECT_STREQ(kBasic, d.data_received().c_str()); } - static URLRequest::ProtocolFactory Factory; + static net::URLRequest::ProtocolFactory Factory; static bool g_async_reads; }; // static -URLRequestJob* URLRequestJobTrackerTest::Factory(URLRequest* request, +URLRequestJob* URLRequestJobTrackerTest::Factory(net::URLRequest* request, const std::string& scheme) { return new URLRequestJobTrackerTestJob(request, g_async_reads); } diff --git a/net/url_request/url_request_netlog_params.h b/net/url_request/url_request_netlog_params.h index 12bd1f1..e7f5ce0 100644 --- a/net/url_request/url_request_netlog_params.h +++ b/net/url_request/url_request_netlog_params.h @@ -13,7 +13,7 @@ #include "net/base/net_log.h" #include "net/base/request_priority.h" -// Holds the parameters to emit to the NetLog when starting a URLRequest. +// Holds the parameters to emit to the NetLog when starting a net::URLRequest. class URLRequestStartEventParameters : public net::NetLog::EventParameters { public: URLRequestStartEventParameters(const GURL& url, diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc index 363d178..c1081ff 100644 --- a/net/url_request/url_request_test_job.cc +++ b/net/url_request/url_request_test_job.cc @@ -70,12 +70,12 @@ std::string URLRequestTestJob::test_error_headers() { } // static -URLRequestJob* URLRequestTestJob::Factory(URLRequest* request, +URLRequestJob* URLRequestTestJob::Factory(net::URLRequest* request, const std::string& scheme) { return new URLRequestTestJob(request); } -URLRequestTestJob::URLRequestTestJob(URLRequest* request) +URLRequestTestJob::URLRequestTestJob(net::URLRequest* request) : URLRequestJob(request), auto_advance_(false), stage_(WAITING), @@ -84,7 +84,8 @@ URLRequestTestJob::URLRequestTestJob(URLRequest* request) async_buf_size_(0) { } -URLRequestTestJob::URLRequestTestJob(URLRequest* request, bool auto_advance) +URLRequestTestJob::URLRequestTestJob(net::URLRequest* request, + bool auto_advance) : URLRequestJob(request), auto_advance_(auto_advance), stage_(WAITING), @@ -93,7 +94,7 @@ URLRequestTestJob::URLRequestTestJob(URLRequest* request, bool auto_advance) async_buf_size_(0) { } -URLRequestTestJob::URLRequestTestJob(URLRequest* request, +URLRequestTestJob::URLRequestTestJob(net::URLRequest* request, const std::string& response_headers, const std::string& response_data, bool auto_advance) diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h index 14b90d4..ec92dc2 100644 --- a/net/url_request/url_request_test_job.h +++ b/net/url_request/url_request_test_job.h @@ -37,16 +37,16 @@ class URLRequestTestJob : public net::URLRequestJob { public: // Constructs a job to return one of the canned responses depending on the // request url, with auto advance disabled. - explicit URLRequestTestJob(URLRequest* request); + explicit URLRequestTestJob(net::URLRequest* request); // Constructs a job to return one of the canned responses depending on the // request url, optionally with auto advance enabled. - explicit URLRequestTestJob(URLRequest* request, bool auto_advance); + explicit URLRequestTestJob(net::URLRequest* request, bool auto_advance); // Constructs a job to return the given response regardless of the request // url. The headers should include the HTTP status line and be formatted as // expected by net::HttpResponseHeaders. - explicit URLRequestTestJob(URLRequest* request, + explicit URLRequestTestJob(net::URLRequest* request, const std::string& response_headers, const std::string& response_data, bool auto_advance); @@ -86,7 +86,7 @@ class URLRequestTestJob : public net::URLRequestJob { void set_auto_advance(bool auto_advance) { auto_advance_ = auto_advance; } // Factory method for protocol factory registration if callers don't subclass - static URLRequest::ProtocolFactory Factory; + static net::URLRequest::ProtocolFactory Factory; // Job functions virtual void Start(); diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 2c44a1c..54f8e6a 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -119,7 +119,7 @@ void CheckSSLInfo(const net::SSLInfo& ssl_info) { class URLRequestTest : public PlatformTest { public: static void SetUpTestCase() { - URLRequest::AllowFileAccess(); + net::URLRequest::AllowFileAccess(); } }; @@ -154,7 +154,7 @@ class URLRequestTestHTTP : public URLRequestTest { for (int i = 0; i < kIterations; ++i) { TestDelegate d; - URLRequest r(test_server_.GetURL("echo"), &d); + net::URLRequest r(test_server_.GetURL("echo"), &d); r.set_context(context); r.set_method(method.c_str()); @@ -188,7 +188,7 @@ TEST_F(URLRequestTestHTTP, ProxyTunnelRedirectTest) { TestDelegate d; { - URLRequest r(GURL("https://www.redirect.com/"), &d); + net::URLRequest r(GURL("https://www.redirect.com/"), &d); r.set_context( new TestURLRequestContext(test_server_.host_port_pair().ToString())); @@ -213,7 +213,7 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) { TestDelegate d; { - URLRequest r(GURL("https://www.server-auth.com/"), &d); + net::URLRequest r(GURL("https://www.server-auth.com/"), &d); r.set_context( new TestURLRequestContext(test_server_.host_port_pair().ToString())); @@ -386,7 +386,7 @@ class SSLClientAuthTestDelegate : public TestDelegate { SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { } virtual void OnCertificateRequested( - URLRequest* request, + net::URLRequest* request, net::SSLCertRequestInfo* cert_request_info) { on_certificate_requested_count_++; MessageLoop::current()->Quit(); @@ -536,7 +536,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { // populate cache { TestDelegate d; - URLRequest r(test_server_.GetURL("cachetime"), &d); + net::URLRequest r(test_server_.GetURL("cachetime"), &d); r.set_context(context); r.Start(); MessageLoop::current()->Run(); @@ -546,7 +546,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { // cancel read from cache (see bug 990242) { TestDelegate d; - URLRequest r(test_server_.GetURL("cachetime"), &d); + net::URLRequest r(test_server_.GetURL("cachetime"), &d); r.set_context(context); r.Start(); r.Cancel(); @@ -1143,7 +1143,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { // populate the cache { TestDelegate d; - URLRequest req(test_server_.GetURL("echoheader?foo"), &d); + net::URLRequest req(test_server_.GetURL("echoheader?foo"), &d); req.set_context(context); net::HttpRequestHeaders headers; headers.SetHeader("foo", "1"); @@ -1155,7 +1155,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { // expect a cache hit { TestDelegate d; - URLRequest req(test_server_.GetURL("echoheader?foo"), &d); + net::URLRequest req(test_server_.GetURL("echoheader?foo"), &d); req.set_context(context); net::HttpRequestHeaders headers; headers.SetHeader("foo", "1"); @@ -1169,7 +1169,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { // expect a cache miss { TestDelegate d; - URLRequest req(test_server_.GetURL("echoheader?foo"), &d); + net::URLRequest req(test_server_.GetURL("echoheader?foo"), &d); req.set_context(context); net::HttpRequestHeaders headers; headers.SetHeader("foo", "2"); @@ -1192,7 +1192,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { d.set_username(kUser); d.set_password(kSecret); - URLRequest r(test_server_.GetURL("auth-basic"), &d); + net::URLRequest r(test_server_.GetURL("auth-basic"), &d); r.set_context(context); r.Start(); @@ -1209,7 +1209,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { d.set_username(kUser); d.set_password(kSecret); - URLRequest r(test_server_.GetURL("auth-basic"), &d); + net::URLRequest r(test_server_.GetURL("auth-basic"), &d); r.set_context(context); r.set_load_flags(net::LOAD_VALIDATE_CACHE); r.Start(); @@ -1239,7 +1239,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { d.set_username(kUser); d.set_password(kSecret); - URLRequest r(url_requiring_auth, &d); + net::URLRequest r(url_requiring_auth, &d); r.set_context(context); r.Start(); @@ -1265,7 +1265,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { replacements.SetPasswordStr(password); GURL url_with_identity = url_requiring_auth.ReplaceComponents(replacements); - URLRequest r(url_with_identity, &d); + net::URLRequest r(url_with_identity, &d); r.set_context(context); r.Start(); @@ -1288,7 +1288,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); + net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); req.set_context(context); req.Start(); MessageLoop::current()->Run(); @@ -1337,8 +1337,8 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), - &d); + net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), + &d); req.set_context(context); req.Start(); MessageLoop::current()->Run(); @@ -1351,7 +1351,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { // Try to set-up another cookie and update the previous cookie. { TestDelegate d; - URLRequest req(test_server.GetURL( + net::URLRequest req(test_server.GetURL( "set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d); req.set_load_flags(net::LOAD_DO_NOT_SAVE_COOKIES); req.set_context(context); @@ -1393,7 +1393,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); + net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); req.set_context(context); req.Start(); MessageLoop::current()->Run(); @@ -1447,8 +1447,8 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), - &d); + net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), + &d); req.set_context(context); req.Start(); MessageLoop::current()->Run(); @@ -1463,7 +1463,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { context->set_cookie_policy(&cookie_policy); TestDelegate d; - URLRequest req(test_server.GetURL( + net::URLRequest req(test_server.GetURL( "set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d); req.set_context(context); req.Start(); @@ -1504,7 +1504,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { // Set up an empty cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie"), &d); + net::URLRequest req(test_server.GetURL("set-cookie"), &d); req.set_context(context); req.Start(); MessageLoop::current()->Run(); @@ -1524,7 +1524,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); + net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); req.set_context(context); req.Start(); MessageLoop::current()->Run(); @@ -1579,8 +1579,8 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), - &d); + net::URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), + &d); req.set_context(context); req.Start(); MessageLoop::current()->Run(); @@ -1596,7 +1596,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { context->set_cookie_policy(&cookie_policy); TestDelegate d; - URLRequest req(test_server.GetURL( + net::URLRequest req(test_server.GetURL( "set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d); req.set_context(context); req.Start(); @@ -1639,8 +1639,8 @@ TEST_F(URLRequestTest, CancelTest_During_CookiePolicy) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"), - &d); + net::URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"), + &d); req.set_context(context); req.Start(); // Triggers an asynchronous cookie policy check. @@ -1654,7 +1654,7 @@ TEST_F(URLRequestTest, CancelTest_During_CookiePolicy) { context->set_cookie_policy(NULL); // Let the cookie policy complete. Make sure it handles the destruction of - // the URLRequest properly. + // the net::URLRequest properly. MessageLoop::current()->RunAllPending(); } @@ -1671,8 +1671,8 @@ TEST_F(URLRequestTest, CancelTest_During_OnGetCookies) { { TestDelegate d; d.set_cancel_in_get_cookies_blocked(true); - URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"), - &d); + net::URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"), + &d); req.set_context(context); req.Start(); // Triggers an asynchronous cookie policy check. @@ -1700,8 +1700,8 @@ TEST_F(URLRequestTest, CancelTest_During_OnSetCookie) { { TestDelegate d; d.set_cancel_in_set_cookie_blocked(true); - URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"), - &d); + net::URLRequest req(test_server.GetURL("set-cookie?A=1&B=2&C=3"), + &d); req.set_context(context); req.Start(); // Triggers an asynchronous cookie policy check. @@ -1733,7 +1733,7 @@ TEST_F(URLRequestTest, CookiePolicy_ForceSession) { // Set up a cookie. { TestDelegate d; - URLRequest req(test_server.GetURL( + net::URLRequest req(test_server.GetURL( "set-cookie?A=1;expires=\"Fri, 05 Feb 2010 23:42:01 GMT\""), &d); req.set_context(context); req.Start(); // Triggers an asynchronous cookie policy check. @@ -1822,7 +1822,7 @@ TEST_F(URLRequestTestHTTP, Post307RedirectPost) { // Custom URLRequestJobs for use with interceptor tests class RestartTestJob : public URLRequestTestJob { public: - explicit RestartTestJob(URLRequest* request) + explicit RestartTestJob(net::URLRequest* request) : URLRequestTestJob(request, true) {} protected: virtual void StartAsync() { @@ -1834,7 +1834,7 @@ class RestartTestJob : public URLRequestTestJob { class CancelTestJob : public URLRequestTestJob { public: - explicit CancelTestJob(URLRequest* request) + explicit CancelTestJob(net::URLRequest* request) : URLRequestTestJob(request, true) {} protected: virtual void StartAsync() { @@ -1846,7 +1846,7 @@ class CancelTestJob : public URLRequestTestJob { class CancelThenRestartTestJob : public URLRequestTestJob { public: - explicit CancelThenRestartTestJob(URLRequest* request) + explicit CancelThenRestartTestJob(net::URLRequest* request) : URLRequestTestJob(request, true) { } protected: @@ -1859,7 +1859,7 @@ class CancelThenRestartTestJob : public URLRequestTestJob { }; // An Interceptor for use with interceptor tests -class TestInterceptor : URLRequest::Interceptor { +class TestInterceptor : net::URLRequest::Interceptor { public: TestInterceptor() : intercept_main_request_(false), restart_main_request_(false), @@ -1872,14 +1872,14 @@ class TestInterceptor : URLRequest::Interceptor { did_simulate_error_main_(false), did_intercept_redirect_(false), did_cancel_redirect_(false), did_intercept_final_(false), did_cancel_final_(false) { - URLRequest::RegisterRequestInterceptor(this); + net::URLRequest::RegisterRequestInterceptor(this); } ~TestInterceptor() { - URLRequest::UnregisterRequestInterceptor(this); + net::URLRequest::UnregisterRequestInterceptor(this); } - virtual URLRequestJob* MaybeIntercept(URLRequest* request) { + virtual URLRequestJob* MaybeIntercept(net::URLRequest* request) { if (restart_main_request_) { restart_main_request_ = false; did_restart_main_ = true; @@ -1911,7 +1911,7 @@ class TestInterceptor : URLRequest::Interceptor { true); } - virtual URLRequestJob* MaybeInterceptRedirect(URLRequest* request, + virtual URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, const GURL& location) { if (cancel_redirect_request_) { cancel_redirect_request_ = false; @@ -1928,7 +1928,7 @@ class TestInterceptor : URLRequest::Interceptor { true); } - virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request) { + virtual URLRequestJob* MaybeInterceptResponse(net::URLRequest* request) { if (cancel_final_request_) { cancel_final_request_ = false; did_cancel_final_ = true; @@ -2019,9 +2019,9 @@ TEST_F(URLRequestTest, Intercept) { TestDelegate d; TestURLRequest req(GURL("http://test_intercept/foo"), &d); - URLRequest::UserData* user_data0 = new URLRequest::UserData(); - URLRequest::UserData* user_data1 = new URLRequest::UserData(); - URLRequest::UserData* user_data2 = new URLRequest::UserData(); + net::URLRequest::UserData* user_data0 = new net::URLRequest::UserData(); + net::URLRequest::UserData* user_data1 = new net::URLRequest::UserData(); + net::URLRequest::UserData* user_data2 = new net::URLRequest::UserData(); req.SetUserData(NULL, user_data0); req.SetUserData(&user_data1, user_data1); req.SetUserData(&user_data2, user_data2); diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h index af8f49e..16b4dc6 100644 --- a/net/url_request/url_request_unittest.h +++ b/net/url_request/url_request_unittest.h @@ -179,17 +179,17 @@ class TestURLRequestContext : public URLRequestContext { //----------------------------------------------------------------------------- -class TestURLRequest : public URLRequest { +class TestURLRequest : public net::URLRequest { public: TestURLRequest(const GURL& url, Delegate* delegate) - : URLRequest(url, delegate) { + : net::URLRequest(url, delegate) { set_context(new TestURLRequestContext()); } }; //----------------------------------------------------------------------------- -class TestDelegate : public URLRequest::Delegate { +class TestDelegate : public net::URLRequest::Delegate { public: TestDelegate() : cancel_in_rr_(false), @@ -213,7 +213,7 @@ class TestDelegate : public URLRequest::Delegate { buf_(new net::IOBuffer(kBufferSize)) { } - virtual void OnReceivedRedirect(URLRequest* request, const GURL& new_url, + virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, bool* defer_redirect) { received_redirect_count_++; if (quit_on_redirect_) { @@ -224,7 +224,7 @@ class TestDelegate : public URLRequest::Delegate { } } - virtual void OnResponseStarted(URLRequest* request) { + virtual void OnResponseStarted(net::URLRequest* request) { // It doesn't make sense for the request to have IO pending at this point. DCHECK(!request->status().is_io_pending()); @@ -247,7 +247,7 @@ class TestDelegate : public URLRequest::Delegate { } } - virtual void OnReadCompleted(URLRequest* request, int bytes_read) { + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { // It doesn't make sense for the request to have IO pending at this point. DCHECK(!request->status().is_io_pending()); @@ -283,12 +283,13 @@ class TestDelegate : public URLRequest::Delegate { request->Cancel(); } - virtual void OnResponseCompleted(URLRequest* request) { + virtual void OnResponseCompleted(net::URLRequest* request) { if (quit_on_complete_) MessageLoop::current()->Quit(); } - void OnAuthRequired(URLRequest* request, net::AuthChallengeInfo* auth_info) { + void OnAuthRequired(net::URLRequest* request, + net::AuthChallengeInfo* auth_info) { if (!username_.empty() || !password_.empty()) { request->SetAuth(username_, password_); } else { @@ -296,7 +297,7 @@ class TestDelegate : public URLRequest::Delegate { } } - virtual void OnSSLCertificateError(URLRequest* request, + virtual void OnSSLCertificateError(net::URLRequest* request, int cert_error, net::X509Certificate* cert) { // The caller can control whether it needs all SSL requests to go through, @@ -309,7 +310,7 @@ class TestDelegate : public URLRequest::Delegate { request->Cancel(); } - virtual void OnGetCookies(URLRequest* request, bool blocked_by_policy) { + virtual void OnGetCookies(net::URLRequest* request, bool blocked_by_policy) { if (blocked_by_policy) { blocked_get_cookies_count_++; if (cancel_in_getcookiesblocked_) @@ -317,7 +318,7 @@ class TestDelegate : public URLRequest::Delegate { } } - virtual void OnSetCookie(URLRequest* request, + virtual void OnSetCookie(net::URLRequest* request, const std::string& cookie_line, const net::CookieOptions& options, bool blocked_by_policy) { |