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

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

Issue 2689373003: Introduce ParallelDownloadJob. (Closed)
Patch Set: Make windows compiler happy. Created 3 years, 10 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 DownloadDangerType danger_type, 105 DownloadDangerType danger_type,
105 DownloadInterruptReason interrupt_reason, 106 DownloadInterruptReason interrupt_reason,
106 bool opened) override; 107 bool opened) override;
107 int InProgressCount() const override; 108 int InProgressCount() const override;
108 int NonMaliciousInProgressCount() const override; 109 int NonMaliciousInProgressCount() const override;
109 BrowserContext* GetBrowserContext() const override; 110 BrowserContext* GetBrowserContext() const override;
110 void CheckForHistoryFilesRemoval() override; 111 void CheckForHistoryFilesRemoval() override;
111 DownloadItem* GetDownload(uint32_t id) override; 112 DownloadItem* GetDownload(uint32_t id) override;
112 DownloadItem* GetDownloadByGuid(const std::string& guid) override; 113 DownloadItem* GetDownloadByGuid(const std::string& guid) override;
113 114
115 // UrlDownloader::Delegate implementation.
116 void OnUrlDownloaderStarted(
117 std::unique_ptr<DownloadCreateInfo> download_create_info,
118 std::unique_ptr<ByteStreamReader> stream_reader,
119 const DownloadUrlParameters::OnStartedCallback& callback) override;
120 void OnUrlDownloaderStopped(UrlDownloader* downloader) override;
121
114 // For testing; specifically, accessed from TestFileErrorInjector. 122 // For testing; specifically, accessed from TestFileErrorInjector.
115 void SetDownloadItemFactoryForTesting( 123 void SetDownloadItemFactoryForTesting(
116 std::unique_ptr<DownloadItemFactory> item_factory); 124 std::unique_ptr<DownloadItemFactory> item_factory);
117 void SetDownloadFileFactoryForTesting( 125 void SetDownloadFileFactoryForTesting(
118 std::unique_ptr<DownloadFileFactory> file_factory); 126 std::unique_ptr<DownloadFileFactory> file_factory);
119 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); 127 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting();
120 128
121 void RemoveUrlDownloader(UrlDownloader* downloader);
122
123 // Helper function to initiate a download request. This function initiates 129 // Helper function to initiate a download request. This function initiates
124 // the download using functionality provided by the 130 // the download using functionality provided by the
125 // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns 131 // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns
126 // the result of the downoad operation. Please see the 132 // the result of the downoad operation. Please see the
127 // DownloadInterruptReason enum for information on possible return values. 133 // DownloadInterruptReason enum for information on possible return values.
128 static DownloadInterruptReason BeginDownloadRequest( 134 static DownloadInterruptReason BeginDownloadRequest(
129 std::unique_ptr<net::URLRequest> url_request, 135 std::unique_ptr<net::URLRequest> url_request,
130 const Referrer& referrer, 136 const Referrer& referrer,
131 ResourceContext* resource_context, 137 ResourceContext* resource_context,
132 bool is_content_initiated, 138 bool is_content_initiated,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 url_downloaders_; 239 url_downloaders_;
234 240
235 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; 241 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_;
236 242
237 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); 243 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
238 }; 244 };
239 245
240 } // namespace content 246 } // namespace content
241 247
242 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 248 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698