OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_mock_link_doctor_job.h" | 5 #include "chrome/browser/net/url_request_mock_link_doctor_job.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/browser/google/google_util.h" | 8 #include "chrome/browser/google/google_util.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "net/url_request/url_request_filter.h" | 11 #include "net/url_request/url_request_filter.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 FilePath GetMockFilePath() { | 15 FilePath GetMockFilePath() { |
16 FilePath test_dir; | 16 FilePath test_dir; |
17 bool success = PathService::Get(chrome::DIR_TEST_DATA, &test_dir); | 17 bool success = PathService::Get(chrome::DIR_TEST_DATA, &test_dir); |
18 DCHECK(success); | 18 DCHECK(success); |
19 return test_dir.AppendASCII("mock-link-doctor.html"); | 19 return test_dir.AppendASCII("mock-link-doctor.html"); |
20 } | 20 } |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 // static | 24 // static |
25 net::URLRequestJob* URLRequestMockLinkDoctorJob::Factory( | 25 net::URLRequestJob* URLRequestMockLinkDoctorJob::Factory( |
26 net::URLRequest* request, | 26 net::URLRequest* request, |
| 27 net::NetworkDelegate* network_delegate, |
27 const std::string& scheme) { | 28 const std::string& scheme) { |
28 return new URLRequestMockLinkDoctorJob(request); | 29 return new URLRequestMockLinkDoctorJob(request, network_delegate); |
29 } | 30 } |
30 | 31 |
31 // static | 32 // static |
32 void URLRequestMockLinkDoctorJob::AddUrlHandler() { | 33 void URLRequestMockLinkDoctorJob::AddUrlHandler() { |
33 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 34 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
34 filter->AddHostnameHandler("http", | 35 filter->AddHostnameHandler("http", |
35 google_util::LinkDoctorBaseURL().host(), | 36 google_util::LinkDoctorBaseURL().host(), |
36 URLRequestMockLinkDoctorJob::Factory); | 37 URLRequestMockLinkDoctorJob::Factory); |
37 } | 38 } |
38 | 39 |
39 URLRequestMockLinkDoctorJob::URLRequestMockLinkDoctorJob( | 40 URLRequestMockLinkDoctorJob::URLRequestMockLinkDoctorJob( |
40 net::URLRequest* request) | 41 net::URLRequest* request, net::NetworkDelegate* network_delegate) |
41 : URLRequestMockHTTPJob(request, GetMockFilePath()) { | 42 : URLRequestMockHTTPJob(request, network_delegate, GetMockFilePath()) { |
42 } | 43 } |
OLD | NEW |