| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/url_request/url_request_context_builder.h" | 5 #include "net/url_request/url_request_context_builder.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 #if !defined(DISABLE_FILE_SUPPORT) | 498 #if !defined(DISABLE_FILE_SUPPORT) |
| 499 if (file_enabled_) { | 499 if (file_enabled_) { |
| 500 job_factory->SetProtocolHandler( | 500 job_factory->SetProtocolHandler( |
| 501 "file", | 501 "file", |
| 502 base::MakeUnique<FileProtocolHandler>(context->GetFileTaskRunner())); | 502 base::MakeUnique<FileProtocolHandler>(context->GetFileTaskRunner())); |
| 503 } | 503 } |
| 504 #endif // !defined(DISABLE_FILE_SUPPORT) | 504 #endif // !defined(DISABLE_FILE_SUPPORT) |
| 505 | 505 |
| 506 #if !defined(DISABLE_FTP_SUPPORT) | 506 #if !defined(DISABLE_FTP_SUPPORT) |
| 507 if (ftp_enabled_) { | 507 if (ftp_enabled_) { |
| 508 ftp_transaction_factory_.reset( | 508 job_factory->SetProtocolHandler( |
| 509 new FtpNetworkLayer(context->host_resolver())); | 509 "ftp", FtpProtocolHandler::Create(context->host_resolver())); |
| 510 job_factory->SetProtocolHandler("ftp", base::MakeUnique<FtpProtocolHandler>( | |
| 511 ftp_transaction_factory_.get())); | |
| 512 } | 510 } |
| 513 #endif // !defined(DISABLE_FTP_SUPPORT) | 511 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 514 | 512 |
| 515 std::unique_ptr<net::URLRequestJobFactory> top_job_factory(job_factory); | 513 std::unique_ptr<net::URLRequestJobFactory> top_job_factory(job_factory); |
| 516 if (!url_request_interceptors_.empty()) { | 514 if (!url_request_interceptors_.empty()) { |
| 517 // Set up interceptors in the reverse order. | 515 // Set up interceptors in the reverse order. |
| 518 | 516 |
| 519 for (auto i = url_request_interceptors_.rbegin(); | 517 for (auto i = url_request_interceptors_.rbegin(); |
| 520 i != url_request_interceptors_.rend(); ++i) { | 518 i != url_request_interceptors_.rend(); ++i) { |
| 521 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( | 519 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
| 522 std::move(top_job_factory), std::move(*i))); | 520 std::move(top_job_factory), std::move(*i))); |
| 523 } | 521 } |
| 524 url_request_interceptors_.clear(); | 522 url_request_interceptors_.clear(); |
| 525 } | 523 } |
| 526 storage->set_job_factory(std::move(top_job_factory)); | 524 storage->set_job_factory(std::move(top_job_factory)); |
| 527 // TODO(willchan): Support sdch. | 525 // TODO(willchan): Support sdch. |
| 528 | 526 |
| 529 return std::move(context); | 527 return std::move(context); |
| 530 } | 528 } |
| 531 | 529 |
| 532 } // namespace net | 530 } // namespace net |
| OLD | NEW |