summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ocsp/nss_ocsp.h6
-rw-r--r--net/proxy/proxy_script_fetcher.h5
-rw-r--r--net/proxy/proxy_script_fetcher_impl.h5
-rw-r--r--net/proxy/proxy_service.h4
-rw-r--r--net/socket_stream/socket_stream_job.h2
-rw-r--r--net/url_request/https_prober.h8
-rw-r--r--net/url_request/url_request.h27
-rw-r--r--net/url_request/url_request_context.cc8
-rw-r--r--net/url_request/url_request_context.h84
-rw-r--r--net/url_request/url_request_ftp_job.h6
-rw-r--r--net/url_request/url_request_http_job.h5
-rw-r--r--net/url_request/url_request_job.h12
-rw-r--r--net/url_request/url_request_job_tracker.h4
-rw-r--r--net/url_request/url_request_status.h9
-rw-r--r--net/url_request/url_request_test_job.cc44
-rw-r--r--net/url_request/url_request_test_job.h29
-rw-r--r--net/url_request/view_cache_helper.h28
-rw-r--r--net/websockets/websocket.h8
18 files changed, 164 insertions, 130 deletions
diff --git a/net/ocsp/nss_ocsp.h b/net/ocsp/nss_ocsp.h
index cf2e66e..fae7a87 100644
--- a/net/ocsp/nss_ocsp.h
+++ b/net/ocsp/nss_ocsp.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,10 +6,10 @@
#define NET_OCSP_NSS_OCSP_H_
#pragma once
-class URLRequestContext;
-
namespace net {
+class URLRequestContext;
+
// Sets the MessageLoop for OCSP to the current message loop.
// This should be called before EnsureOCSPInit() if you want to
// control the message loop for OCSP.
diff --git a/net/proxy/proxy_script_fetcher.h b/net/proxy/proxy_script_fetcher.h
index bf33bcb..9829316 100644
--- a/net/proxy/proxy_script_fetcher.h
+++ b/net/proxy/proxy_script_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -14,10 +14,11 @@
#include "net/base/completion_callback.h"
class GURL;
-class URLRequestContext;
namespace net {
+class URLRequestContext;
+
// Interface for downloading a PAC script. Implementations can enforce
// timeouts, maximum size constraints, content encoding, etc..
class ProxyScriptFetcher {
diff --git a/net/proxy/proxy_script_fetcher_impl.h b/net/proxy/proxy_script_fetcher_impl.h
index 446165045..bd141f3 100644
--- a/net/proxy/proxy_script_fetcher_impl.h
+++ b/net/proxy/proxy_script_fetcher_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -16,11 +16,12 @@
#include "net/url_request/url_request.h"
class GURL;
-class URLRequestContext;
class X509Certificate;
namespace net {
+class URLRequestContext;
+
// Implementation of ProxyScriptFetcher that downloads scripts using the
// specified request context.
class ProxyScriptFetcherImpl : public ProxyScriptFetcher,
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index 131c98c..f9424d7 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -21,7 +21,6 @@
class GURL;
class MessageLoop;
-class URLRequestContext;
namespace net {
@@ -29,6 +28,7 @@ class HostResolver;
class InitProxyResolver;
class ProxyResolver;
class ProxyScriptFetcher;
+class URLRequestContext;
// This class can be used to resolve the proxy server to use when loading a
// HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy
diff --git a/net/socket_stream/socket_stream_job.h b/net/socket_stream/socket_stream_job.h
index a301709..973c20a 100644
--- a/net/socket_stream/socket_stream_job.h
+++ b/net/socket_stream/socket_stream_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
diff --git a/net/url_request/https_prober.h b/net/url_request/https_prober.h
index 5d1a6222..6540224 100644
--- a/net/url_request/https_prober.h
+++ b/net/url_request/https_prober.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -14,10 +14,11 @@
#include "net/url_request/url_request.h"
template <typename T> struct DefaultSingletonTraits;
-class URLRequestContext;
namespace net {
+class URLRequestContext;
+
// This should be scoped inside HTTPSProber, but VC cannot compile
// HTTPProber::Delegate when HTTPSProber also inherits from
// net::URLRequest::Delegate.
@@ -77,4 +78,5 @@ class HTTPSProber : public net::URLRequest::Delegate {
};
} // namespace net
-#endif
+
+#endif // NET_BASE_HTTPS_PROBER_H_
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index 9d4347d..3561a29 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -28,17 +28,7 @@ namespace base {
class Time;
} // namespace base
-namespace net {
-class CookieOptions;
-class IOBuffer;
-class SSLCertRequestInfo;
-class UploadData;
-class URLRequestJob;
-class X509Certificate;
-} // namespace net
-
class FilePath;
-class URLRequestContext;
// This stores the values of the Set-Cookie headers received during the request.
// Each item in the vector corresponds to a Set-Cookie: line received,
@@ -46,6 +36,15 @@ class URLRequestContext;
typedef std::vector<std::string> ResponseCookies;
namespace net {
+
+class CookieOptions;
+class IOBuffer;
+class SSLCertRequestInfo;
+class UploadData;
+class URLRequestContext;
+class URLRequestJob;
+class X509Certificate;
+
//-----------------------------------------------------------------------------
// A class representing the asynchronous load of a data stream from an URL.
//
@@ -435,7 +434,7 @@ class URLRequest : public base::NonThreadSafe {
bool is_pending() const { return is_pending_; }
// Returns the error status of the request.
- const URLRequestStatus& status() const { return status_; }
+ const net::URLRequestStatus& status() const { return status_; }
// This method is called to start the request. The delegate will receive
// a OnResponseStarted callback when the request is started.
@@ -550,7 +549,7 @@ class URLRequest : public base::NonThreadSafe {
void set_is_pending(bool value) { is_pending_ = value; }
// Allow the URLRequestJob class to set our status too
- void set_status(const URLRequestStatus& value) { status_ = value; }
+ void set_status(const net::URLRequestStatus& value) { status_ = value; }
// Allow the URLRequestJob to redirect this request. Returns net::OK if
// successful, otherwise an error code is returned.
@@ -610,7 +609,7 @@ class URLRequest : public base::NonThreadSafe {
// Current error status of the job. When no error has been encountered, this
// will be SUCCESS. If multiple errors have been encountered, this will be
// the first non-SUCCESS status seen.
- URLRequestStatus status_;
+ net::URLRequestStatus status_;
// The HTTP response info, lazily initialized.
net::HttpResponseInfo response_info_;
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
index 3bc7da6..8e0f3bd 100644
--- a/net/url_request/url_request_context.cc
+++ b/net/url_request/url_request_context.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -8,6 +8,8 @@
#include "net/base/cookie_store.h"
#include "net/base/host_resolver.h"
+namespace net {
+
URLRequestContext::URLRequestContext()
: net_log_(NULL),
host_resolver_(NULL),
@@ -30,6 +32,8 @@ const std::string& URLRequestContext::GetUserAgent(const GURL& url) const {
URLRequestContext::~URLRequestContext() {
}
-void URLRequestContext::set_cookie_store(net::CookieStore* cookie_store) {
+void URLRequestContext::set_cookie_store(CookieStore* cookie_store) {
cookie_store_ = cookie_store;
}
+
+} // namespace net
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 517148e..b54faf4 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -33,9 +33,8 @@ class HttpNetworkDelegate;
class HttpTransactionFactory;
class SSLConfigService;
class URLRequest;
-} // namespace net
-// Subclass to provide application-specific context for net::URLRequest
+// Subclass to provide application-specific context for URLRequest
// instances.
class URLRequestContext
: public base::RefCountedThreadSafe<URLRequestContext>,
@@ -43,94 +42,94 @@ class URLRequestContext
public:
URLRequestContext();
- net::NetLog* net_log() const {
+ NetLog* net_log() const {
return net_log_;
}
- void set_net_log(net::NetLog* net_log) {
+ void set_net_log(NetLog* net_log) {
net_log_ = net_log;
}
- net::HostResolver* host_resolver() const {
+ HostResolver* host_resolver() const {
return host_resolver_;
}
- void set_host_resolver(net::HostResolver* host_resolver) {
+ void set_host_resolver(HostResolver* host_resolver) {
host_resolver_ = host_resolver;
}
- net::CertVerifier* cert_verifier() const {
+ CertVerifier* cert_verifier() const {
return cert_verifier_;
}
- void set_cert_verifier(net::CertVerifier* cert_verifier) {
+ void set_cert_verifier(CertVerifier* cert_verifier) {
cert_verifier_ = cert_verifier;
}
- net::DnsRRResolver* dnsrr_resolver() const {
+ DnsRRResolver* dnsrr_resolver() const {
return dnsrr_resolver_;
}
- void set_dnsrr_resolver(net::DnsRRResolver* dnsrr_resolver) {
+ void set_dnsrr_resolver(DnsRRResolver* dnsrr_resolver) {
dnsrr_resolver_ = dnsrr_resolver;
}
- net::DnsCertProvenanceChecker* dns_cert_checker() const {
+ DnsCertProvenanceChecker* dns_cert_checker() const {
return dns_cert_checker_.get();
}
// Get the proxy service for this context.
- net::ProxyService* proxy_service() const {
+ ProxyService* proxy_service() const {
return proxy_service_;
}
- void set_proxy_service(net::ProxyService* proxy_service) {
+ void set_proxy_service(ProxyService* proxy_service) {
proxy_service_ = proxy_service;
}
// Get the ssl config service for this context.
- net::SSLConfigService* ssl_config_service() const {
+ SSLConfigService* ssl_config_service() const {
return ssl_config_service_;
}
// Gets the HTTP Authentication Handler Factory for this context.
// The factory is only valid for the lifetime of this URLRequestContext
- net::HttpAuthHandlerFactory* http_auth_handler_factory() {
+ HttpAuthHandlerFactory* http_auth_handler_factory() {
return http_auth_handler_factory_;
}
- void set_http_auth_handler_factory(net::HttpAuthHandlerFactory* factory) {
+ void set_http_auth_handler_factory(HttpAuthHandlerFactory* factory) {
http_auth_handler_factory_ = factory;
}
// Gets the http transaction factory for this context.
- net::HttpTransactionFactory* http_transaction_factory() const {
+ HttpTransactionFactory* http_transaction_factory() const {
return http_transaction_factory_;
}
- void set_http_transaction_factory(net::HttpTransactionFactory* factory) {
+ void set_http_transaction_factory(HttpTransactionFactory* factory) {
http_transaction_factory_ = factory;
}
// Gets the ftp transaction factory for this context.
- net::FtpTransactionFactory* ftp_transaction_factory() {
+ FtpTransactionFactory* ftp_transaction_factory() {
return ftp_transaction_factory_;
}
// Gets the cookie store for this context (may be null, in which case
// cookies are not stored).
- net::CookieStore* cookie_store() { return cookie_store_.get(); }
+ CookieStore* cookie_store() { return cookie_store_.get(); }
- void set_cookie_store(net::CookieStore* cookie_store);
+ void set_cookie_store(CookieStore* cookie_store);
// Gets the cookie policy for this context (may be null, in which case
// cookies are allowed).
- net::CookiePolicy* cookie_policy() { return cookie_policy_; }
+ CookiePolicy* cookie_policy() { return cookie_policy_; }
- net::TransportSecurityState* transport_security_state() {
+ TransportSecurityState* transport_security_state() {
return transport_security_state_; }
// Gets the FTP authentication cache for this context.
- net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
+ FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
// Gets the value of 'Accept-Charset' header field.
const std::string& accept_charset() const { return accept_charset_; }
@@ -162,21 +161,21 @@ class URLRequestContext
// The following members are expected to be initialized and owned by
// subclasses.
- net::NetLog* net_log_;
- net::HostResolver* host_resolver_;
- net::CertVerifier* cert_verifier_;
- net::DnsRRResolver* dnsrr_resolver_;
- scoped_ptr<net::DnsCertProvenanceChecker> dns_cert_checker_;
- scoped_refptr<net::ProxyService> proxy_service_;
- scoped_refptr<net::SSLConfigService> ssl_config_service_;
- net::HttpTransactionFactory* http_transaction_factory_;
- net::FtpTransactionFactory* ftp_transaction_factory_;
- net::HttpAuthHandlerFactory* http_auth_handler_factory_;
- net::HttpNetworkDelegate* network_delegate_;
- scoped_refptr<net::CookieStore> cookie_store_;
- net::CookiePolicy* cookie_policy_;
- scoped_refptr<net::TransportSecurityState> transport_security_state_;
- net::FtpAuthCache ftp_auth_cache_;
+ NetLog* net_log_;
+ HostResolver* host_resolver_;
+ CertVerifier* cert_verifier_;
+ DnsRRResolver* dnsrr_resolver_;
+ scoped_ptr<DnsCertProvenanceChecker> dns_cert_checker_;
+ scoped_refptr<ProxyService> proxy_service_;
+ scoped_refptr<SSLConfigService> ssl_config_service_;
+ HttpTransactionFactory* http_transaction_factory_;
+ FtpTransactionFactory* ftp_transaction_factory_;
+ HttpAuthHandlerFactory* http_auth_handler_factory_;
+ HttpNetworkDelegate* network_delegate_;
+ scoped_refptr<CookieStore> cookie_store_;
+ CookiePolicy* cookie_policy_;
+ scoped_refptr<TransportSecurityState> transport_security_state_;
+ FtpAuthCache ftp_auth_cache_;
std::string accept_language_;
std::string accept_charset_;
// The charset of the referrer where this request comes from. It's not
@@ -191,4 +190,9 @@ class URLRequestContext
DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
};
+} // namespace net
+
+// TODO(tfarina): Fix the callers and remove this!
+typedef net::URLRequestContext URLRequestContext;
+
#endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
diff --git a/net/url_request/url_request_ftp_job.h b/net/url_request/url_request_ftp_job.h
index d503766..ed65214 100644
--- a/net/url_request/url_request_ftp_job.h
+++ b/net/url_request/url_request_ftp_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -16,10 +16,10 @@
#include "net/ftp/ftp_transaction.h"
#include "net/url_request/url_request_job.h"
-class URLRequestContext;
-
namespace net {
+class URLRequestContext;
+
// A URLRequestJob subclass that is built on top of FtpTransaction. It
// provides an implementation for FTP.
class URLRequestFtpJob : public URLRequestJob {
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h
index 78778c5..fbd8baf 100644
--- a/net/url_request/url_request_http_job.h
+++ b/net/url_request/url_request_http_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -18,12 +18,11 @@
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_throttler_entry_interface.h"
-class URLRequestContext;
-
namespace net {
class HttpResponseInfo;
class HttpTransaction;
+class URLRequestContext;
// A net::URLRequestJob subclass that is built on top of HttpTransaction. It
// provides an implementation for both HTTP and HTTPS.
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index 6f91c9a9..23a3232 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -17,7 +17,6 @@
#include "net/base/filter.h"
#include "net/base/load_states.h"
-class URLRequestStatus;
namespace net {
@@ -28,6 +27,7 @@ class IOBuffer;
class URLRequest;
class URLRequestJobMetrics;
class UploadData;
+class URLRequestStatus;
class X509Certificate;
class URLRequestJob : public base::RefCounted<URLRequestJob>,
@@ -225,13 +225,13 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>,
void NotifyReadComplete(int bytes_read);
// Notifies the request that a start error has occurred.
- void NotifyStartError(const URLRequestStatus& status);
+ void NotifyStartError(const net::URLRequestStatus& status);
// NotifyDone marks when we are done with a request. It is really
// a glorified set_status, but also does internal state checking and
// job tracking. It should be called once per request, when the job is
// finished doing all IO.
- void NotifyDone(const URLRequestStatus& status);
+ void NotifyDone(const net::URLRequestStatus& status);
// Some work performed by NotifyDone must be completed on a separate task
// so as to avoid re-entering the delegate. This method exists to perform
@@ -282,10 +282,10 @@ class URLRequestJob : public base::RefCounted<URLRequestJob>,
net::URLRequest* request_;
// The status of the job.
- const URLRequestStatus GetStatus();
+ const net::URLRequestStatus GetStatus();
// Set the status of the job.
- void SetStatus(const URLRequestStatus& status);
+ void SetStatus(const net::URLRequestStatus& status);
// Whether the job is doing performance profiling
bool is_profiling_;
diff --git a/net/url_request/url_request_job_tracker.h b/net/url_request/url_request_job_tracker.h
index 4c8ecec..4a03cf7 100644
--- a/net/url_request/url_request_job_tracker.h
+++ b/net/url_request/url_request_job_tracker.h
@@ -40,7 +40,7 @@ class URLRequestJobTracker {
// Called when the given job has completed, before notifying the request
virtual void OnJobDone(URLRequestJob* job,
- const URLRequestStatus& status) = 0;
+ const net::URLRequestStatus& status) = 0;
// Called when the given job is about to follow a redirect to the given
// new URL. The redirect type is given in status_code
@@ -77,7 +77,7 @@ class URLRequestJobTracker {
void RemoveJob(URLRequestJob* job);
// Job status change notifications
- void OnJobDone(URLRequestJob* job, const URLRequestStatus& status);
+ void OnJobDone(URLRequestJob* job, const net::URLRequestStatus& status);
void OnJobRedirect(URLRequestJob* job, const GURL& location,
int status_code);
diff --git a/net/url_request/url_request_status.h b/net/url_request/url_request_status.h
index ca376fb..332e7e9 100644
--- a/net/url_request/url_request_status.h
+++ b/net/url_request/url_request_status.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
//
@@ -9,6 +9,8 @@
#define NET_URL_REQUEST_URL_REQUEST_STATUS_H_
#pragma once
+namespace net {
+
// Represents the result of a URL request. It encodes errors and various
// types of success.
class URLRequestStatus {
@@ -64,4 +66,9 @@ class URLRequestStatus {
int os_error_;
};
+} // namespace net
+
+// TODO(tfarina): Fix the callers and remove this!
+typedef net::URLRequestStatus URLRequestStatus;
+
#endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index 7fd019c..4aa7c16 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -16,7 +16,9 @@
// This emulates the global message loop for the test URL request class, since
// this is only test code, it's probably not too dangerous to have this static
// object.
-static std::vector< scoped_refptr<URLRequestTestJob> > pending_jobs;
+static std::vector< scoped_refptr<URLRequestTestJob> > g_pending_jobs;
+
+namespace net {
// static getters for known URLs
GURL URLRequestTestJob::test_url_1() {
@@ -70,13 +72,13 @@ std::string URLRequestTestJob::test_error_headers() {
}
// static
-net::URLRequestJob* URLRequestTestJob::Factory(net::URLRequest* request,
- const std::string& scheme) {
+URLRequestJob* URLRequestTestJob::Factory(URLRequest* request,
+ const std::string& scheme) {
return new URLRequestTestJob(request);
}
-URLRequestTestJob::URLRequestTestJob(net::URLRequest* request)
- : net::URLRequestJob(request),
+URLRequestTestJob::URLRequestTestJob(URLRequest* request)
+ : URLRequestJob(request),
auto_advance_(false),
stage_(WAITING),
offset_(0),
@@ -84,9 +86,9 @@ URLRequestTestJob::URLRequestTestJob(net::URLRequest* request)
async_buf_size_(0) {
}
-URLRequestTestJob::URLRequestTestJob(net::URLRequest* request,
+URLRequestTestJob::URLRequestTestJob(URLRequest* request,
bool auto_advance)
- : net::URLRequestJob(request),
+ : URLRequestJob(request),
auto_advance_(auto_advance),
stage_(WAITING),
offset_(0),
@@ -94,14 +96,14 @@ URLRequestTestJob::URLRequestTestJob(net::URLRequest* request,
async_buf_size_(0) {
}
-URLRequestTestJob::URLRequestTestJob(net::URLRequest* request,
+URLRequestTestJob::URLRequestTestJob(URLRequest* request,
const std::string& response_headers,
const std::string& response_data,
bool auto_advance)
- : net::URLRequestJob(request),
+ : URLRequestJob(request),
auto_advance_(auto_advance),
stage_(WAITING),
- response_headers_(new net::HttpResponseHeaders(response_headers)),
+ response_headers_(new HttpResponseHeaders(response_headers)),
response_data_(response_data),
offset_(0),
async_buf_(NULL),
@@ -127,7 +129,7 @@ void URLRequestTestJob::Start() {
void URLRequestTestJob::StartAsync() {
if (!response_headers_) {
- response_headers_ = new net::HttpResponseHeaders(test_headers());
+ response_headers_ = new HttpResponseHeaders(test_headers());
if (request_->url().spec() == test_url_1().spec()) {
response_data_ = test_data_1();
stage_ = DATA_AVAILABLE; // Simulate a synchronous response for this one.
@@ -140,7 +142,7 @@ void URLRequestTestJob::StartAsync() {
// FIXME(brettw) we may want to use WININET errors or have some more types
// of errors
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
- net::ERR_INVALID_URL));
+ ERR_INVALID_URL));
// FIXME(brettw): this should emulate a network error, and not just fail
// initiating a connection
return;
@@ -152,7 +154,7 @@ void URLRequestTestJob::StartAsync() {
this->NotifyHeadersComplete();
}
-bool URLRequestTestJob::ReadRawData(net::IOBuffer* buf, int buf_size,
+bool URLRequestTestJob::ReadRawData(IOBuffer* buf, int buf_size,
int *bytes_read) {
if (stage_ == WAITING) {
async_buf_ = buf;
@@ -179,7 +181,7 @@ bool URLRequestTestJob::ReadRawData(net::IOBuffer* buf, int buf_size,
return true;
}
-void URLRequestTestJob::GetResponseInfo(net::HttpResponseInfo* info) {
+void URLRequestTestJob::GetResponseInfo(HttpResponseInfo* info) {
if (response_headers_)
info->headers = response_headers_;
}
@@ -207,7 +209,7 @@ bool URLRequestTestJob::IsRedirectResponse(GURL* location,
void URLRequestTestJob::Kill() {
stage_ = DONE;
- net::URLRequestJob::Kill();
+ URLRequestJob::Kill();
}
void URLRequestTestJob::ProcessNextOperation() {
@@ -244,18 +246,20 @@ void URLRequestTestJob::AdvanceJob() {
this, &URLRequestTestJob::ProcessNextOperation));
return;
}
- pending_jobs.push_back(scoped_refptr<URLRequestTestJob>(this));
+ g_pending_jobs.push_back(scoped_refptr<URLRequestTestJob>(this));
}
// static
bool URLRequestTestJob::ProcessOnePendingMessage() {
- if (pending_jobs.empty())
+ if (g_pending_jobs.empty())
return false;
- scoped_refptr<URLRequestTestJob> next_job(pending_jobs[0]);
- pending_jobs.erase(pending_jobs.begin());
+ scoped_refptr<URLRequestTestJob> next_job(g_pending_jobs[0]);
+ g_pending_jobs.erase(g_pending_jobs.begin());
DCHECK(!next_job->auto_advance()); // auto_advance jobs should be in this q
next_job->ProcessNextOperation();
return true;
}
+
+} // namespace net
diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h
index ec92dc2..252c173 100644
--- a/net/url_request/url_request_test_job.h
+++ b/net/url_request/url_request_test_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,6 +11,8 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
+namespace net {
+
// This job type is designed to help with simple unit tests. To use, you
// probably want to inherit from it to set up the state you want. Then install
// it as the protocol handler for the "test" scheme.
@@ -33,20 +35,20 @@
//
// Optionally, you can also construct test jobs that advance automatically
// without having to call ProcessOnePendingMessage.
-class URLRequestTestJob : public net::URLRequestJob {
+class URLRequestTestJob : public URLRequestJob {
public:
// Constructs a job to return one of the canned responses depending on the
// request url, with auto advance disabled.
- explicit URLRequestTestJob(net::URLRequest* request);
+ explicit URLRequestTestJob(URLRequest* request);
// Constructs a job to return one of the canned responses depending on the
// request url, optionally with auto advance enabled.
- explicit URLRequestTestJob(net::URLRequest* request, bool auto_advance);
+ explicit URLRequestTestJob(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(net::URLRequest* request,
+ // expected by HttpResponseHeaders.
+ explicit URLRequestTestJob(URLRequest* request,
const std::string& response_headers,
const std::string& response_data,
bool auto_advance);
@@ -86,14 +88,14 @@ 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 net::URLRequest::ProtocolFactory Factory;
+ static URLRequest::ProtocolFactory Factory;
// Job functions
virtual void Start();
- virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
+ virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read);
virtual void Kill();
virtual bool GetMimeType(std::string* mime_type) const;
- virtual void GetResponseInfo(net::HttpResponseInfo* info);
+ virtual void GetResponseInfo(HttpResponseInfo* info);
virtual int GetResponseCode() const;
virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
@@ -120,7 +122,7 @@ class URLRequestTestJob : public net::URLRequestJob {
// The headers the job should return, will be set in Start() if not provided
// in the explicit ctor.
- scoped_refptr<net::HttpResponseHeaders> response_headers_;
+ scoped_refptr<HttpResponseHeaders> response_headers_;
// The data to send, will be set in Start() if not provided in the explicit
// ctor.
@@ -130,8 +132,13 @@ class URLRequestTestJob : public net::URLRequestJob {
int offset_;
// Holds the buffer for an asynchronous ReadRawData call
- net::IOBuffer* async_buf_;
+ IOBuffer* async_buf_;
int async_buf_size_;
};
+} // namespace net
+
+// TODO(tfarina): Fix the callers and remove this!
+typedef net::URLRequestTestJob URLRequestTestJob;
+
#endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_
diff --git a/net/url_request/view_cache_helper.h b/net/url_request/view_cache_helper.h
index 03af714..1952916 100644
--- a/net/url_request/view_cache_helper.h
+++ b/net/url_request/view_cache_helper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,15 +11,15 @@
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
-class URLRequestContext;
-
namespace disk_cache {
class Backend;
class Entry;
-}
+} // namespace disk_cache
namespace net {
+class URLRequestContext;
+
class ViewCacheHelper {
public:
ViewCacheHelper();
@@ -29,16 +29,20 @@ class ViewCacheHelper {
// If this method returns ERR_IO_PENDING, |callback| will be notified when the
// operation completes. |out| must remain valid until this operation completes
// or the object is destroyed.
- int GetEntryInfoHTML(const std::string& key, URLRequestContext* context,
- std::string* out, CompletionCallback* callback);
+ int GetEntryInfoHTML(const std::string& key,
+ net::URLRequestContext* context,
+ std::string* out,
+ CompletionCallback* callback);
// Formats the cache contents as HTML. Returns a net error code.
// If this method returns ERR_IO_PENDING, |callback| will be notified when the
// operation completes. |out| must remain valid until this operation completes
// or the object is destroyed. |url_prefix| will be prepended to each entry
// key as a link to the entry.
- int GetContentsHTML(URLRequestContext* context, const std::string& url_prefix,
- std::string* out, CompletionCallback* callback);
+ int GetContentsHTML(net::URLRequestContext* context,
+ const std::string& url_prefix,
+ std::string* out,
+ CompletionCallback* callback);
private:
enum State {
@@ -56,8 +60,10 @@ class ViewCacheHelper {
};
// Implements GetEntryInfoHTML and GetContentsHTML.
- int GetInfoHTML(const std::string& key, URLRequestContext* context,
- const std::string& url_prefix, std::string* out,
+ int GetInfoHTML(const std::string& key,
+ net::URLRequestContext* context,
+ const std::string& url_prefix,
+ std::string* out,
CompletionCallback* callback);
// This is a helper function used to trigger a completion callback. It may
@@ -87,7 +93,7 @@ class ViewCacheHelper {
// Called to signal completion of asynchronous IO.
void OnIOComplete(int result);
- scoped_refptr<URLRequestContext> context_;
+ scoped_refptr<net::URLRequestContext> context_;
disk_cache::Backend* disk_cache_;
disk_cache::Entry* entry_;
void* iter_;
diff --git a/net/websockets/websocket.h b/net/websockets/websocket.h
index c729afc..ec1297a 100644
--- a/net/websockets/websocket.h
+++ b/net/websockets/websocket.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
//
@@ -74,7 +74,7 @@ class WebSocket : public base::RefCountedThreadSafe<WebSocket>,
Request(const GURL& url, const std::string protocol,
const std::string origin, const std::string location,
ProtocolVersion version,
- URLRequestContext* context)
+ net::URLRequestContext* context)
: url_(url),
protocol_(protocol),
origin_(origin),
@@ -90,7 +90,7 @@ class WebSocket : public base::RefCountedThreadSafe<WebSocket>,
const std::string& origin() const { return origin_; }
const std::string& location() const { return location_; }
ProtocolVersion version() const { return version_; }
- URLRequestContext* context() const { return context_; }
+ net::URLRequestContext* context() const { return context_; }
// Sets an alternative HostResolver. For testing purposes only.
void SetHostResolver(HostResolver* host_resolver) {
@@ -113,7 +113,7 @@ class WebSocket : public base::RefCountedThreadSafe<WebSocket>,
std::string origin_;
std::string location_;
ProtocolVersion version_;
- scoped_refptr<URLRequestContext> context_;
+ scoped_refptr<net::URLRequestContext> context_;
HostResolver* host_resolver_;
ClientSocketFactory* client_socket_factory_;