summaryrefslogtreecommitdiffstats
path: root/content/common/net
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 07:12:14 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 07:12:14 +0000
commitd3ec669b62912a5464e1c89fde7218d06e4a5522 (patch)
tree3ba696064595f3a1c8fe6e0ede9735b8d5ba34b2 /content/common/net
parent3ea8fe2d0851618159039209591354085a137b11 (diff)
downloadchromium_src-d3ec669b62912a5464e1c89fde7218d06e4a5522.zip
chromium_src-d3ec669b62912a5464e1c89fde7218d06e4a5522.tar.gz
chromium_src-d3ec669b62912a5464e1c89fde7218d06e4a5522.tar.bz2
Change most content::URLFetcher references to net::URLFetcher
The only remaining use of content::URLFetcher is content::URLFetcher::Create. Make content::URLFetcher not inherit from net::URLFetcher. Also make code that directly create URLFetcherImpl instead call content::URLFetcher::Create. BUG=118220 TEST= TBR=mnissler@chromium.org,sky@chromium.org,mal@chromium.org,sail@chromium.org Review URL: https://chromiumcodereview.appspot.com/10412050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138443 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/net')
-rw-r--r--content/common/net/url_fetcher_core.cc28
-rw-r--r--content/common/net/url_fetcher_core.h8
-rw-r--r--content/common/net/url_fetcher_impl.cc8
-rw-r--r--content/common/net/url_fetcher_impl.h4
-rw-r--r--content/common/net/url_fetcher_impl_unittest.cc20
5 files changed, 35 insertions, 33 deletions
diff --git a/content/common/net/url_fetcher_core.cc b/content/common/net/url_fetcher_core.cc
index a9ea391..e2f9452 100644
--- a/content/common/net/url_fetcher_core.cc
+++ b/content/common/net/url_fetcher_core.cc
@@ -242,9 +242,9 @@ void URLFetcherCore::FileWriter::RemoveFile() {
static bool g_interception_enabled = false;
-URLFetcherCore::URLFetcherCore(URLFetcher* fetcher,
+URLFetcherCore::URLFetcherCore(net::URLFetcher* fetcher,
const GURL& original_url,
- URLFetcher::RequestType request_type,
+ net::URLFetcher::RequestType request_type,
net::URLFetcherDelegate* d)
: fetcher_(fetcher),
original_url_(original_url),
@@ -254,7 +254,7 @@ URLFetcherCore::URLFetcherCore(URLFetcher* fetcher,
base::MessageLoopProxy::current()),
request_(NULL),
load_flags_(net::LOAD_NORMAL),
- response_code_(URLFetcher::RESPONSE_CODE_INVALID),
+ response_code_(net::URLFetcher::RESPONSE_CODE_INVALID),
buffer_(new net::IOBuffer(kBufferSize)),
url_request_data_key_(NULL),
was_fetched_via_proxy_(false),
@@ -407,7 +407,7 @@ void URLFetcherCore::SetFirstPartyForCookies(
void URLFetcherCore::SetURLRequestUserData(
const void* key,
- const URLFetcher::CreateDataCallback& create_data_callback) {
+ const net::URLFetcher::CreateDataCallback& create_data_callback) {
DCHECK(key);
DCHECK(!create_data_callback.is_null());
url_request_data_key_ = key;
@@ -638,7 +638,7 @@ void URLFetcherCore::OnReadCompleted(net::URLRequest* request,
// See comments re: HEAD requests in ReadResponse().
if ((!status.is_io_pending() && !waiting_on_write) ||
- (request_type_ == URLFetcher::HEAD)) {
+ (request_type_ == net::URLFetcher::HEAD)) {
status_ = status;
ReleaseRequest();
@@ -701,7 +701,8 @@ void URLFetcherCore::ReadResponse() {
// completed immediately, without trying to read any data back (all we care
// about is the response code and headers, which we already have).
int bytes_read = 0;
- if (request_->status().is_success() && (request_type_ != URLFetcher::HEAD))
+ if (request_->status().is_success() &&
+ (request_type_ != net::URLFetcher::HEAD))
request_->Read(buffer_, kBufferSize, &bytes_read);
OnReadCompleted(request_.get(), bytes_read);
}
@@ -743,15 +744,16 @@ void URLFetcherCore::StartURLRequest() {
}
switch (request_type_) {
- case URLFetcher::GET:
+ case net::URLFetcher::GET:
break;
- case URLFetcher::POST:
- case URLFetcher::PUT:
+ case net::URLFetcher::POST:
+ case net::URLFetcher::PUT:
DCHECK(!upload_content_.empty() || is_chunked_upload_);
DCHECK(!upload_content_type_.empty());
- request_->set_method(request_type_ == URLFetcher::POST ? "POST" : "PUT");
+ request_->set_method(
+ request_type_ == net::URLFetcher::POST ? "POST" : "PUT");
extra_request_headers_.SetHeader(net::HttpRequestHeaders::kContentType,
upload_content_type_);
if (!upload_content_.empty()) {
@@ -771,11 +773,11 @@ void URLFetcherCore::StartURLRequest() {
&URLFetcherCore::InformDelegateUploadProgress);
break;
- case URLFetcher::HEAD:
+ case net::URLFetcher::HEAD:
request_->set_method("HEAD");
break;
- case URLFetcher::DELETE_REQUEST:
+ case net::URLFetcher::DELETE_REQUEST:
request_->set_method("DELETE");
break;
@@ -928,7 +930,7 @@ void URLFetcherCore::NotifyMalformedContent() {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
if (url_throttler_entry_ != NULL) {
int status_code = response_code_;
- if (status_code == URLFetcher::RESPONSE_CODE_INVALID) {
+ if (status_code == net::URLFetcher::RESPONSE_CODE_INVALID) {
// The status code will generally be known by the time clients
// call the |ReceivedContentWasMalformed()| function (which ends up
// calling the current function) but if it's not, we need to assume
diff --git a/content/common/net/url_fetcher_core.h b/content/common/net/url_fetcher_core.h
index 9694a83d..211dbe1 100644
--- a/content/common/net/url_fetcher_core.h
+++ b/content/common/net/url_fetcher_core.h
@@ -45,9 +45,9 @@ class URLFetcherCore
: public base::RefCountedThreadSafe<URLFetcherCore>,
public net::URLRequest::Delegate {
public:
- URLFetcherCore(URLFetcher* fetcher,
+ URLFetcherCore(net::URLFetcher* fetcher,
const GURL& original_url,
- URLFetcher::RequestType request_type,
+ net::URLFetcher::RequestType request_type,
net::URLFetcherDelegate* d);
// Starts the load. It's important that this not happen in the constructor
@@ -294,10 +294,10 @@ class URLFetcherCore
void InformDelegateDownloadDataInDelegateThread(
scoped_ptr<std::string> download_data);
- URLFetcher* fetcher_; // Corresponding fetcher object
+ net::URLFetcher* fetcher_; // Corresponding fetcher object
GURL original_url_; // The URL we were asked to fetch
GURL url_; // The URL we eventually wound up at
- URLFetcher::RequestType request_type_; // What type of request is this?
+ net::URLFetcher::RequestType request_type_; // What type of request is this?
net::URLRequestStatus status_; // Status of the request
net::URLFetcherDelegate* delegate_; // Object to notify on completion
scoped_refptr<base::MessageLoopProxy> delegate_loop_proxy_;
diff --git a/content/common/net/url_fetcher_impl.cc b/content/common/net/url_fetcher_impl.cc
index 1a3ff60..c0709f5 100644
--- a/content/common/net/url_fetcher_impl.cc
+++ b/content/common/net/url_fetcher_impl.cc
@@ -13,18 +13,18 @@
static content::URLFetcherFactory* g_factory = NULL;
// static
-content::URLFetcher* content::URLFetcher::Create(
+net::URLFetcher* content::URLFetcher::Create(
const GURL& url,
- RequestType request_type,
+ net::URLFetcher::RequestType request_type,
net::URLFetcherDelegate* d) {
return new URLFetcherImpl(url, request_type, d);
}
// static
-content::URLFetcher* content::URLFetcher::Create(
+net::URLFetcher* content::URLFetcher::Create(
int id,
const GURL& url,
- RequestType request_type,
+ net::URLFetcher::RequestType request_type,
net::URLFetcherDelegate* d) {
return g_factory ? g_factory->CreateURLFetcher(id, url, request_type, d) :
new URLFetcherImpl(url, request_type, d);
diff --git a/content/common/net/url_fetcher_impl.h b/content/common/net/url_fetcher_impl.h
index e451eeb..9fb9776 100644
--- a/content/common/net/url_fetcher_impl.h
+++ b/content/common/net/url_fetcher_impl.h
@@ -26,7 +26,7 @@ class URLFetcherDelegate;
class URLFetcherFactory;
} // namespace content
-class CONTENT_EXPORT URLFetcherImpl : public content::URLFetcher {
+class CONTENT_EXPORT URLFetcherImpl : public net::URLFetcher {
public:
// |url| is the URL to send the request to.
// |request_type| is the type of request to make.
@@ -36,7 +36,7 @@ class CONTENT_EXPORT URLFetcherImpl : public content::URLFetcher {
net::URLFetcherDelegate* d);
virtual ~URLFetcherImpl();
- // content::URLFetcher implementation:
+ // net::URLFetcher implementation:
virtual void SetUploadData(const std::string& upload_content_type,
const std::string& upload_content) OVERRIDE;
virtual void SetChunkedUpload(
diff --git a/content/common/net/url_fetcher_impl_unittest.cc b/content/common/net/url_fetcher_impl_unittest.cc
index 9e1374b..d8bacd0 100644
--- a/content/common/net/url_fetcher_impl_unittest.cc
+++ b/content/common/net/url_fetcher_impl_unittest.cc
@@ -126,7 +126,7 @@ class URLFetcherTest : public testing::Test,
};
void URLFetcherTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
fetcher_->Start();
@@ -364,7 +364,7 @@ class URLFetcherFileTest : public URLFetcherTest {
};
void URLFetcherPostTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::POST, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::POST, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
fetcher_->SetUploadData("application/x-www-form-urlencoded",
@@ -380,7 +380,7 @@ void URLFetcherPostTest::OnURLFetchComplete(const net::URLFetcher* source) {
}
void URLFetcherDownloadProgressTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
previous_progress_ = 0;
@@ -398,7 +398,7 @@ void URLFetcherDownloadProgressTest::OnURLFetchDownloadProgress(
}
void URLFetcherDownloadProgressCancelTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
cancelled_ = false;
@@ -424,7 +424,7 @@ void URLFetcherDownloadProgressCancelTest::OnURLFetchComplete(
}
void URLFetcherUploadProgressTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::POST, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::POST, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
previous_progress_ = 0;
@@ -470,7 +470,7 @@ void URLFetcherSocketAddressTest::OnURLFetchComplete(
}
void URLFetcherProtectTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
start_time_ = Time::Now();
@@ -510,7 +510,7 @@ void URLFetcherProtectTest::OnURLFetchComplete(
}
void URLFetcherProtectTestPassedThrough::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
fetcher_->SetAutomaticallyRetryOn5xx(false);
@@ -573,7 +573,7 @@ void URLFetcherBadHTTPSTest::OnURLFetchComplete(
}
void URLFetcherCancelTest::CreateFetcher(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
CancelTestURLRequestContextGetter* context_getter =
new CancelTestURLRequestContextGetter(io_message_loop_proxy(),
url);
@@ -627,7 +627,7 @@ void URLFetcherMultipleAttemptTest::OnURLFetchComplete(
void URLFetcherFileTest::CreateFetcherForFile(const GURL& url,
const FilePath& file_path) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));
@@ -637,7 +637,7 @@ void URLFetcherFileTest::CreateFetcherForFile(const GURL& url,
}
void URLFetcherFileTest::CreateFetcherForTempFile(const GURL& url) {
- fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this);
+ fetcher_ = new URLFetcherImpl(url, net::URLFetcher::GET, this);
fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter(
io_message_loop_proxy(), request_context()));