Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: content/browser/download/download_manager_impl.h

Issue 2689373003: Introduce ParallelDownloadJob. (Closed)
Patch Set: nits. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 namespace content { 35 namespace content {
36 class DownloadFileFactory; 36 class DownloadFileFactory;
37 class DownloadItemFactory; 37 class DownloadItemFactory;
38 class DownloadItemImpl; 38 class DownloadItemImpl;
39 class DownloadRequestHandleInterface; 39 class DownloadRequestHandleInterface;
40 class ResourceContext; 40 class ResourceContext;
41 41
42 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, 42 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager,
43 public UrlDownloader::Delegate,
43 private DownloadItemImplDelegate { 44 private DownloadItemImplDelegate {
44 public: 45 public:
45 using DownloadItemImplCreated = base::Callback<void(DownloadItemImpl*)>; 46 using DownloadItemImplCreated = base::Callback<void(DownloadItemImpl*)>;
46 47
47 // Caller guarantees that |net_log| will remain valid 48 // Caller guarantees that |net_log| will remain valid
48 // for the lifetime of DownloadManagerImpl (until Shutdown() is called). 49 // for the lifetime of DownloadManagerImpl (until Shutdown() is called).
49 DownloadManagerImpl(net::NetLog* net_log, BrowserContext* browser_context); 50 DownloadManagerImpl(net::NetLog* net_log, BrowserContext* browser_context);
50 ~DownloadManagerImpl() override; 51 ~DownloadManagerImpl() override;
51 52
52 // Implementation functions (not part of the DownloadManager interface). 53 // Implementation functions (not part of the DownloadManager interface).
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DownloadInterruptReason interrupt_reason, 106 DownloadInterruptReason interrupt_reason,
106 bool opened, 107 bool opened,
107 const std::vector<DownloadItem::ReceivedSlice>& received_slices) override; 108 const std::vector<DownloadItem::ReceivedSlice>& received_slices) override;
108 int InProgressCount() const override; 109 int InProgressCount() const override;
109 int NonMaliciousInProgressCount() const override; 110 int NonMaliciousInProgressCount() const override;
110 BrowserContext* GetBrowserContext() const override; 111 BrowserContext* GetBrowserContext() const override;
111 void CheckForHistoryFilesRemoval() override; 112 void CheckForHistoryFilesRemoval() override;
112 DownloadItem* GetDownload(uint32_t id) override; 113 DownloadItem* GetDownload(uint32_t id) override;
113 DownloadItem* GetDownloadByGuid(const std::string& guid) override; 114 DownloadItem* GetDownloadByGuid(const std::string& guid) override;
114 115
116 // UrlDownloader::Delegate implementation.
117 void OnUrlDownloaderStarted(
118 std::unique_ptr<DownloadCreateInfo> download_create_info,
119 std::unique_ptr<ByteStreamReader> stream_reader,
120 const DownloadUrlParameters::OnStartedCallback& callback) override;
121 void OnUrlDownloaderStopped(UrlDownloader* downloader) override;
122
115 // For testing; specifically, accessed from TestFileErrorInjector. 123 // For testing; specifically, accessed from TestFileErrorInjector.
116 void SetDownloadItemFactoryForTesting( 124 void SetDownloadItemFactoryForTesting(
117 std::unique_ptr<DownloadItemFactory> item_factory); 125 std::unique_ptr<DownloadItemFactory> item_factory);
118 void SetDownloadFileFactoryForTesting( 126 void SetDownloadFileFactoryForTesting(
119 std::unique_ptr<DownloadFileFactory> file_factory); 127 std::unique_ptr<DownloadFileFactory> file_factory);
120 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); 128 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting();
121 129
122 void RemoveUrlDownloader(UrlDownloader* downloader);
123
124 // Helper function to initiate a download request. This function initiates 130 // Helper function to initiate a download request. This function initiates
125 // the download using functionality provided by the 131 // the download using functionality provided by the
126 // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns 132 // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns
127 // the result of the downoad operation. Please see the 133 // the result of the downoad operation. Please see the
128 // DownloadInterruptReason enum for information on possible return values. 134 // DownloadInterruptReason enum for information on possible return values.
129 static DownloadInterruptReason BeginDownloadRequest( 135 static DownloadInterruptReason BeginDownloadRequest(
130 std::unique_ptr<net::URLRequest> url_request, 136 std::unique_ptr<net::URLRequest> url_request,
131 const Referrer& referrer, 137 const Referrer& referrer,
132 ResourceContext* resource_context, 138 ResourceContext* resource_context,
133 bool is_content_initiated, 139 bool is_content_initiated,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 url_downloaders_; 240 url_downloaders_;
235 241
236 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; 242 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_;
237 243
238 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); 244 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
239 }; 245 };
240 246
241 } // namespace content 247 } // namespace content
242 248
243 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 249 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_job_unittest.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698