WebKit roll 90808:90810
[chromium-blink-merge.git] / net / url_request / url_request_redirect_job.cc
blob8cefb391d86901d6d1eae521a1be3aa99fd78618
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.
5 #include "net/url_request/url_request_redirect_job.h"
7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h"
10 namespace net {
12 URLRequestRedirectJob::URLRequestRedirectJob(URLRequest* request,
13 const GURL& redirect_destination)
14 : URLRequestJob(request),
15 redirect_destination_(redirect_destination),
16 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {}
18 void URLRequestRedirectJob::Start() {
19 MessageLoop::current()->PostTask(
20 FROM_HERE,
21 method_factory_.NewRunnableMethod(&URLRequestRedirectJob::StartAsync));
24 bool URLRequestRedirectJob::IsRedirectResponse(GURL* location,
25 int* http_status_code) {
26 *location = redirect_destination_;
27 *http_status_code = 302;
28 return true;
31 URLRequestRedirectJob::~URLRequestRedirectJob() {}
33 void URLRequestRedirectJob::StartAsync() {
34 NotifyHeadersComplete();
37 } // namespace net