url_request_job.h revision 7dbb3d5cf0c15f500944d211057644d6a2f37371
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)#ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define NET_URL_REQUEST_URL_REQUEST_JOB_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector>
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/ref_counted.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/weak_ptr.h"
14c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/message_loop.h"
15c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/power_monitor/power_observer.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/filter.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/host_port_pair.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/load_states.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/net_export.h"
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/base/request_priority.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/upload_progress.h"
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/cookies/canonical_cookie.h"
237dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "url/gurl.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class AuthChallengeInfo;
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class AuthCredentials;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CookieOptions;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpRequestHeaders;
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpResponseInfo;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class IOBuffer;
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct LoadTimingInfo;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NetworkDelegate;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SSLCertRequestInfo;
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SSLInfo;
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequest;
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class UploadDataStream;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestStatus;
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class X509Certificate;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
42c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class NET_EXPORT URLRequestJob
43c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)    : public base::RefCounted<URLRequestJob>,
44c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      public base::PowerObserver {
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  explicit URLRequestJob(URLRequest* request,
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                         NetworkDelegate* network_delegate);
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the request that owns this job. THIS POINTER MAY BE NULL if the
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // request was destroyed.
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  URLRequest* request() const {
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return request_;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the upload data, most requests have no upload data, so this is a NOP.
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Job types supporting upload data will override this.
572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void SetUpload(UploadDataStream* upload_data_stream);
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Sets extra request headers for Job types that support request
602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // headers. Called once before Start() is called.
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers);
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Sets the priority of the job. Called once before Start() is
642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // called, but also when the priority of the parent request changes.
652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void SetPriority(RequestPriority priority);
662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If any error occurs while starting the Job, NotifyStartError should be
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // called.
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This helps ensure that all errors follow more similar notification code
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // paths, which should simplify testing.
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Start() = 0;
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This function MUST somehow call NotifyDone/NotifyCanceled or some requests
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // will get leaked. Certain callers use that message to know when they can
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // delete their URLRequest object, even when doing a cancel. The default
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Kill implementation calls NotifyCanceled, so it is recommended that
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // subclasses call URLRequestJob::Kill() after doing any additional work.
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The job should endeavor to stop working as soon as is convenient, but must
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // not send and complete notifications from inside this function. Instead,
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // complete notifications (including "canceled") should be sent from a
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // callback run from the message loop.
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The job is not obliged to immediately stop sending data in response to
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // this call, nor is it obliged to fail with "canceled" unless not all data
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // was sent as a result. A typical case would be where the job is almost
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // complete and can succeed before the canceled notification can be
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // dispatched (from the message loop).
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The job should be prepared to receive multiple calls to kill it, but only
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // one notification must be issued.
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Kill();
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to detach the request from this Job.  Results in the Job being
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // killed off eventually. The job must not use the request pointer any more.
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DetachRequest();
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to read post-filtered data from this Job, returning the number of
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // bytes read, 0 when there is no more data, or -1 if there was an error.
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is just the backend for URLRequest::Read, see that function for
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // more info.
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool Read(IOBuffer* buf, int buf_size, int* bytes_read);
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Stops further caching of this request, if any. For more info, see
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // URLRequest::StopCaching().
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void StopCaching();
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
108eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual bool GetFullRequestHeaders(HttpRequestHeaders* headers) const;
109eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to fetch the current load state for the job.
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual LoadState GetLoadState() const;
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to get the upload progress in bytes.
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual UploadProgress GetUploadProgress() const;
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to fetch the charset for this request.  Only makes sense for some
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // types of requests. Returns true on success.  Calling this on a type that
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // doesn't have a charset will return false.
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool GetCharset(std::string* charset);
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to get response info.
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GetResponseInfo(HttpResponseInfo* info);
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
124c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // This returns the times when events actually occurred, rather than the time
125c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // each event blocked the request.  See FixupLoadTimingInfo in url_request.h
126c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // for more information on the difference.
1272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const;
1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the cookie values included in the response, if applicable.
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if applicable.
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NOTE: This removes the cookies from the job, so it will only return
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //       useful results once per job.
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool GetResponseCookies(std::vector<std::string>* cookies);
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to setup a stream filter for this request. An example of filter is
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // content encoding/decoding.
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Subclasses should return the appropriate Filter, or NULL for no Filter.
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This class takes ownership of the returned Filter.
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The default implementation returns NULL.
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual Filter* SetupFilter() const;
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to determine if this response is a redirect.  Only makes sense
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // for some types of requests.  This method returns true if the response
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // is a redirect, and fills in the location param with the URL of the
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // redirect.  The HTTP status code (e.g., 302) is filled into
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |*http_status_code| to signify the type of redirect.
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The caller is responsible for following the redirect by setting up an
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // appropriate replacement Job. Note that the redirected location may be
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // invalid, the caller should be sure it can handle this.
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The default implementation inspects the response_info_.
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to determine if it is okay to redirect this job to the specified
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // location.  This may be used to implement protocol-specific restrictions.
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If this function returns false, then the URLRequest will fail
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // reporting ERR_UNSAFE_REDIRECT.
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsSafeRedirect(const GURL& location);
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to determine if this response is asking for authentication.  Only
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // makes sense for some types of requests.  The caller is responsible for
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // obtaining the credentials passing them to SetAuth.
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool NeedsAuth();
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Fills the authentication info with the server's response.
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void GetAuthChallengeInfo(
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      scoped_refptr<AuthChallengeInfo>* auth_info);
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Resend the request with authentication credentials.
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetAuth(const AuthCredentials& credentials);
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Display the error page without asking for credentials again.
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void CancelAuth();
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ContinueWithCertificate(X509Certificate* client_cert);
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Continue processing the request ignoring the last error.
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ContinueDespiteLastError();
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void FollowDeferredRedirect();
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the Job is done producing response data and has called
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NotifyDone on the request.
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool is_done() const { return done_; }
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Get/Set expected content size
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int64 expected_content_size() const { return expected_content_size_; }
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_expected_content_size(const int64& size) {
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    expected_content_size_ = size;
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether we have processed the response for that request yet.
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool has_response_started() const { return has_handled_response_; }
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These methods are not applicable to all connections.
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool GetMimeType(std::string* mime_type) const;
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetResponseCode() const;
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the socket address for the connection.
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // See url_request.h for details.
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual HostPortPair GetSocketAddress() const;
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // base::PowerObserver methods:
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // We invoke URLRequestJob::Kill on suspend (crbug.com/4606).
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnSuspend() OVERRIDE;
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called after a NetworkDelegate has been informed that the URLRequest
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // will be destroyed. This is used to track that no pending callbacks
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // exist at destruction time of the URLRequestJob, unless they have been
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call.
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void NotifyURLRequestDestroyed();
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class base::RefCounted<URLRequestJob>;
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~URLRequestJob();
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notifies the job that a certificate is requested.
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyCertificateRequested(SSLCertRequestInfo* cert_request_info);
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notifies the job about an SSL certificate error.
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifySSLCertificateError(const SSLInfo& ssl_info, bool fatal);
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Delegates to URLRequest::Delegate.
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool CanGetCookies(const CookieList& cookie_list) const;
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Delegates to URLRequest::Delegate.
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool CanSetCookie(const std::string& cookie_line,
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    CookieOptions* options) const;
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
23290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Delegates to URLRequest::Delegate.
23390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  bool CanEnablePrivacyMode() const;
23490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notifies the job that headers have been received.
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyHeadersComplete();
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notifies the request that the job has completed a Read operation.
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyReadComplete(int bytes_read);
2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notifies the request that a start error has occurred.
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyStartError(const URLRequestStatus& status);
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NotifyDone marks when we are done with a request.  It is really
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // a glorified set_status, but also does internal state checking and
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // job tracking.  It should be called once per request, when the job is
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // finished doing all IO.
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyDone(const URLRequestStatus& status);
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Some work performed by NotifyDone must be completed on a separate task
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // so as to avoid re-entering the delegate.  This method exists to perform
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // that work.
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CompleteNotifyDone();
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used as an asynchronous callback for Kill to notify the URLRequest
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // that we were canceled.
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyCanceled();
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notifies the job the request should be restarted.
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Should only be called if the job has not started a resposne.
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void NotifyRestartRequired();
2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Called when the network delegate blocks or unblocks this request when
2642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // intercepting certain requests.
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetBlockedOnDelegate();
2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetUnblockedOnDelegate();
2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to read raw (pre-filtered) data from this Job.
2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If returning true, data was read from the job.  buf will contain
2705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the data, and bytes_read will receive the number of bytes read.
2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If returning true, and bytes_read is returned as 0, there is no
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // additional data to be read.
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If returning false, an error occurred or an async IO is now pending.
2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If async IO is pending, the status of the request will be
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // URLRequestStatus::IO_PENDING, and buf must remain available until the
2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // operation is completed.  See comments on URLRequest::Read for more
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // info.
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read);
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to tell the job that a filter has successfully reached the end of
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the stream.
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void DoneReading();
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Informs the filter that data has been read into its buffer
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void FilteredDataRead(int bytes_read);
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Reads filtered data from the request.  Returns true if successful,
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // false otherwise.  Note, if there is not enough data received to
2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // return data, this call can issue a new async IO request under
2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the hood.
2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool ReadFilteredData(int *bytes_read);
2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether the response is being filtered in this job.
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Only valid after NotifyHeadersComplete() has been called.
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool HasFilter() { return filter_ != NULL; }
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // At or near destruction time, a derived class may request that the filters
2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be destroyed so that statistics can be gathered while the derived class is
2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // still present to assist in calculations.  This is used by URLRequestHttpJob
3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // to get SDCH to emit stats.
3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DestroyFilters() { filter_.reset(); }
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Provides derived classes with access to the request's network delegate.
3042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  NetworkDelegate* network_delegate() { return network_delegate_; }
3052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The status of the job.
3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const URLRequestStatus GetStatus();
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set the status of the job.
3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetStatus(const URLRequestStatus& status);
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The number of bytes read before passing to the filter.
3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int prefilter_bytes_read() const { return prefilter_bytes_read_; }
3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The number of bytes read after passing through the filter.
3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int postfilter_bytes_read() const { return postfilter_bytes_read_; }
3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Total number of bytes read from network (or cache) and typically handed
3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // to filter to process.  Used to histogram compression ratios, and error
3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // recovery scenarios in filters.
3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int64 filter_input_byte_count() const { return filter_input_byte_count_; }
3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The request that initiated this job. This value MAY BE NULL if the
3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // request was released by DetachRequest().
3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  URLRequest* request_;
3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // When data filtering is enabled, this function is used to read data
3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // for the filter.  Returns true if raw data was read.  Returns false if
3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // an error occurred (or we are waiting for IO to complete).
3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool ReadRawDataForFilter(int *bytes_read);
3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Invokes ReadRawData and records bytes read if the read completes
3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // synchronously.
3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool ReadRawDataHelper(IOBuffer* buf, int buf_size, int* bytes_read);
3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called in response to a redirect that was not canceled to follow the
3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // redirect. The current job will be replaced with a new job loading the
3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // given redirect destination.
3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void FollowRedirect(const GURL& location, int http_status_code);
3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called after every raw read. If |bytes_read| is > 0, this indicates
3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // a successful read of |bytes_read| unfiltered bytes. If |bytes_read|
3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // is 0, this indicates that there is no additional data to read. If
3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |bytes_read| is < 0, an error occurred and no bytes were read.
3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void OnRawReadComplete(int bytes_read);
3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates the profiling info and notifies observers that an additional
3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |bytes_read| unfiltered bytes have been read for this job.
3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RecordBytesRead(int bytes_read);
3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called to query whether there is data available in the filter to be read
3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // out.
3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool FilterHasData();
3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Subclasses may implement this method to record packet arrival times.
3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The default implementation does nothing.
3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdatePacketReadTimes();
3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Custom handler for derived classes when the request is detached.
3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnDetachRequest() {}
3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Indicates that the job is done producing data, either it has completed
3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // all the data or an error has been encountered. Set exclusively by
3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // NotifyDone so that it is kept in sync with the request.
3665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool done_;
3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int prefilter_bytes_read_;
3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int postfilter_bytes_read_;
3705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int64 filter_input_byte_count_;
3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The data stream filter which is enabled on demand.
3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<Filter> filter_;
3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If the filter filled its output buffer, then there is a change that it
3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // still has internal data to emit, and this flag is set.
3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool filter_needs_more_output_space_;
3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // When we filter data, we receive data into the filter buffers.  After
3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // processing the filtered data, we return the data in the caller's buffer.
3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // While the async IO is in progress, we save the user buffer here, and
3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // when the IO completes, we fill this in.
3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<IOBuffer> filtered_read_buffer_;
3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int filtered_read_buffer_len_;
3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // We keep a pointer to the read buffer while asynchronous reads are
3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in progress, so we are able to pass those bytes to job observers.
3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<IOBuffer> raw_read_buffer_;
3895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used by HandleResponseIfNecessary to track whether we've sent the
3915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // OnResponseStarted callback and potentially redirect callbacks as well.
3925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool has_handled_response_;
3935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Expected content size
3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int64 expected_content_size_;
3965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set when a redirect is deferred.
3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GURL deferred_redirect_url_;
3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int deferred_redirect_status_code_;
4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // The network delegate to use with this request, if any.
4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  NetworkDelegate* network_delegate_;
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::WeakPtrFactory<URLRequestJob> weak_factory_;
4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(URLRequestJob);
4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace net
4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // NET_URL_REQUEST_URL_REQUEST_JOB_H_
412