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"
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(
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;
31 URLRequestRedirectJob::~URLRequestRedirectJob() {}
33 void URLRequestRedirectJob::StartAsync() {
34 NotifyHeadersComplete();