OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/net/url_request_failed_dns_job.h" | 5 #include "chrome/browser/net/url_request_failed_dns_job.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
11 #include "net/url_request/url_request_filter.h" | 11 #include "net/url_request/url_request_filter.h" |
12 | 12 |
13 const char URLRequestFailedDnsJob::kTestUrl[] = | 13 const char URLRequestFailedDnsJob::kTestUrl[] = |
14 "http://url.handled.by.fake.dns/"; | 14 "http://url.handled.by.fake.dns/"; |
15 | 15 |
16 void URLRequestFailedDnsJob::Start() { | 16 void URLRequestFailedDnsJob::Start() { |
17 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 17 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
18 this, &URLRequestFailedDnsJob::StartAsync)); | 18 this, &URLRequestFailedDnsJob::StartAsync)); |
19 } | 19 } |
20 | 20 |
21 /* static */ | 21 /* static */ |
22 void URLRequestFailedDnsJob::AddUrlHandler() { | 22 void URLRequestFailedDnsJob::AddUrlHandler() { |
23 URLRequestFilter* filter = URLRequestFilter::GetInstance(); | 23 URLRequestFilter* filter = URLRequestFilter::GetInstance(); |
24 filter->AddUrlHandler(GURL(kTestUrl), | 24 filter->AddUrlHandler(GURL(kTestUrl), |
25 &URLRequestFailedDnsJob::Factory); | 25 &URLRequestFailedDnsJob::Factory); |
26 } | 26 } |
27 | 27 |
28 /*static */ | 28 /*static */ |
29 URLRequestJob* URLRequestFailedDnsJob::Factory(URLRequest* request, | 29 URLRequestJob* URLRequestFailedDnsJob::Factory(net::URLRequest* request, |
30 const std::string& scheme) { | 30 const std::string& scheme) { |
31 return new URLRequestFailedDnsJob(request); | 31 return new URLRequestFailedDnsJob(request); |
32 } | 32 } |
33 | 33 |
34 void URLRequestFailedDnsJob::StartAsync() { | 34 void URLRequestFailedDnsJob::StartAsync() { |
35 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, | 35 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, |
36 net::ERR_NAME_NOT_RESOLVED)); | 36 net::ERR_NAME_NOT_RESOLVED)); |
37 } | 37 } |
OLD | NEW |