15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/url_request/url_fetcher_impl.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/bind.h"
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/message_loop/message_loop_proxy.h"
9f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "base/sequenced_task_runner.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/url_request/url_fetcher_core.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/url_request/url_fetcher_factory.h"
124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "net/url_request/url_fetcher_response_writer.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)static URLFetcherFactory* g_factory = NULL;
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)URLFetcherImpl::URLFetcherImpl(const GURL& url,
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                               RequestType request_type,
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                               URLFetcherDelegate* d)
21c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    : core_(new URLFetcherCore(this, url, request_type, d)) {
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)URLFetcherImpl::~URLFetcherImpl() {
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->Stop();
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetUploadData(const std::string& upload_content_type,
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   const std::string& upload_content) {
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetUploadData(upload_content_type, upload_content);
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void URLFetcherImpl::SetUploadFilePath(
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    const std::string& upload_content_type,
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    const base::FilePath& file_path,
36c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    uint64 range_offset,
37c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    uint64 range_length,
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    scoped_refptr<base::TaskRunner> file_task_runner) {
39c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  core_->SetUploadFilePath(upload_content_type,
40c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                           file_path,
41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                           range_offset,
42c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                           range_length,
43c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)                           file_task_runner);
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetChunkedUpload(const std::string& content_type) {
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetChunkedUpload(content_type);
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::AppendChunkToUpload(const std::string& data,
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                         bool is_last_chunk) {
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DCHECK(data.length());
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->AppendChunkToUpload(data, is_last_chunk);
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetReferrer(const std::string& referrer) {
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetReferrer(referrer);
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)void URLFetcherImpl::SetReferrerPolicy(
615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    URLRequest::ReferrerPolicy referrer_policy) {
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  core_->SetReferrerPolicy(referrer_policy);
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetLoadFlags(int load_flags) {
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetLoadFlags(load_flags);
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)int URLFetcherImpl::GetLoadFlags() const {
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetLoadFlags();
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetExtraRequestHeaders(
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const std::string& extra_request_headers) {
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetExtraRequestHeaders(extra_request_headers);
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::AddExtraRequestHeader(const std::string& header_line) {
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->AddExtraRequestHeader(header_line);
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetRequestContext(
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    URLRequestContextGetter* request_context_getter) {
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetRequestContext(request_context_getter);
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetFirstPartyForCookies(
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const GURL& first_party_for_cookies) {
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetFirstPartyForCookies(first_party_for_cookies);
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetURLRequestUserData(
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const void* key,
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const CreateDataCallback& create_data_callback) {
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetURLRequestUserData(key, create_data_callback);
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetStopOnRedirect(bool stop_on_redirect) {
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetStopOnRedirect(stop_on_redirect);
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetAutomaticallyRetryOn5xx(bool retry) {
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SetAutomaticallyRetryOn5xx(retry);
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void URLFetcherImpl::SetMaxRetriesOn5xx(int max_retries) {
1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  core_->SetMaxRetriesOn5xx(max_retries);
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)int URLFetcherImpl::GetMaxRetriesOn5xx() const {
1112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  return core_->GetMaxRetriesOn5xx();
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)base::TimeDelta URLFetcherImpl::GetBackoffDelay() const {
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetBackoffDelay();
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void URLFetcherImpl::SetAutomaticallyRetryOnNetworkChanges(int max_retries) {
1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  core_->SetAutomaticallyRetryOnNetworkChanges(max_retries);
1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SaveResponseToFileAtPath(
1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    const base::FilePath& file_path,
125f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    scoped_refptr<base::SequencedTaskRunner> file_task_runner) {
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SaveResponseToFileAtPath(file_path, file_task_runner);
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SaveResponseToTemporaryFile(
130f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    scoped_refptr<base::SequencedTaskRunner> file_task_runner) {
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->SaveResponseToTemporaryFile(file_task_runner);
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1344e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)void URLFetcherImpl::SaveResponseWithWriter(
1354e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    scoped_ptr<URLFetcherResponseWriter> response_writer) {
1364e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  core_->SaveResponseWithWriter(response_writer.Pass());
1374e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
1384e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)HttpResponseHeaders* URLFetcherImpl::GetResponseHeaders() const {
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetResponseHeaders();
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)HostPortPair URLFetcherImpl::GetSocketAddress() const {
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetSocketAddress();
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool URLFetcherImpl::WasFetchedViaProxy() const {
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->WasFetchedViaProxy();
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::Start() {
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->Start();
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const GURL& URLFetcherImpl::GetOriginalURL() const {
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetOriginalURL();
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const GURL& URLFetcherImpl::GetURL() const {
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetURL();
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const URLRequestStatus& URLFetcherImpl::GetStatus() const {
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetStatus();
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)int URLFetcherImpl::GetResponseCode() const {
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetResponseCode();
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)const ResponseCookies& URLFetcherImpl::GetCookies() const {
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetCookies();
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::ReceivedContentWasMalformed() {
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  core_->ReceivedContentWasMalformed();
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool URLFetcherImpl::GetResponseAsString(
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    std::string* out_response_string) const {
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetResponseAsString(out_response_string);
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool URLFetcherImpl::GetResponseAsFilePath(
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    bool take_ownership,
1862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    base::FilePath* out_response_path) const {
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->GetResponseAsFilePath(take_ownership, out_response_path);
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// static
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::CancelAll() {
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  URLFetcherCore::CancelAll();
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// static
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::SetEnableInterceptionForTests(bool enabled) {
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  URLFetcherCore::SetEnableInterceptionForTests(enabled);
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// static
2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void URLFetcherImpl::SetIgnoreCertificateRequests(bool ignored) {
2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  URLFetcherCore::SetIgnoreCertificateRequests(ignored);
2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// static
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)int URLFetcherImpl::GetNumFetcherCores() {
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return URLFetcherCore::GetNumFetcherCores();
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)URLFetcherDelegate* URLFetcherImpl::delegate() const {
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return core_->delegate();
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// static
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)URLFetcherFactory* URLFetcherImpl::factory() {
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return g_factory;
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// static
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void URLFetcherImpl::set_factory(URLFetcherFactory* factory) {
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  g_factory = factory;
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace net
225