| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "content/browser/download/download_job_factory.h" | 5 #include "content/browser/download/download_job_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "content/browser/download/download_item_impl.h" | 10 #include "content/browser/download/download_item_impl.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 if (!satisfy_connection_type) { | 70 if (!satisfy_connection_type) { |
| 71 RecordParallelDownloadCreationEvent( | 71 RecordParallelDownloadCreationEvent( |
| 72 ParallelDownloadCreationEvent::FALLBACK_REASON_CONNECTION_TYPE); | 72 ParallelDownloadCreationEvent::FALLBACK_REASON_CONNECTION_TYPE); |
| 73 } | 73 } |
| 74 | 74 |
| 75 return should_use_parallel_download; | 75 return should_use_parallel_download; |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace | 78 } // namespace |
| 79 | 79 |
| 80 // static |
| 80 std::unique_ptr<DownloadJob> DownloadJobFactory::CreateJob( | 81 std::unique_ptr<DownloadJob> DownloadJobFactory::CreateJob( |
| 81 DownloadItemImpl* download_item, | 82 DownloadItemImpl* download_item, |
| 82 std::unique_ptr<DownloadRequestHandleInterface> req_handle, | 83 std::unique_ptr<DownloadRequestHandleInterface> req_handle, |
| 83 const DownloadCreateInfo& create_info) { | 84 const DownloadCreateInfo& create_info) { |
| 84 // Build parallel download job. | 85 // Build parallel download job. |
| 85 if (ShouldUseParallelDownload(create_info)) { | 86 if (ShouldUseParallelDownload(create_info)) { |
| 86 return base::MakeUnique<ParallelDownloadJob>(download_item, | 87 return base::MakeUnique<ParallelDownloadJob>(download_item, |
| 87 std::move(req_handle), | 88 std::move(req_handle), |
| 88 create_info); | 89 create_info); |
| 89 } | 90 } |
| 90 | 91 |
| 91 // An ordinary download job. | 92 // An ordinary download job. |
| 92 return base::MakeUnique<DownloadJobImpl>(download_item, | 93 return base::MakeUnique<DownloadJobImpl>(download_item, |
| 93 std::move(req_handle)); | 94 std::move(req_handle)); |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace | 97 } // namespace |
| OLD | NEW |