• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
6 #define NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
7 #pragma once
8 
9 #include "base/task.h"
10 #include "net/url_request/url_request_job.h"
11 
12 class GURL;
13 
14 namespace net {
15 
16 // A URLRequestJob that will redirect the request to the specified
17 // URL.  This is useful to restart a request at a different URL based
18 // on the result of another job.
19 class URLRequestRedirectJob : public URLRequestJob {
20  public:
21   // Constructs a job that redirects to the specified URL.
22   URLRequestRedirectJob(URLRequest* request, const GURL& redirect_destination);
23 
24   virtual void Start();
25   virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
26 
27  private:
28   virtual ~URLRequestRedirectJob();
29 
30   void StartAsync();
31 
32   GURL redirect_destination_;
33 
34   ScopedRunnableMethodFactory<URLRequestRedirectJob> method_factory_;
35 };
36 
37 }  // namespace net
38 
39 #endif  // NET_URL_REQUEST_URL_REQUEST_REDIRECT_JOB_H_
40