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

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

Issue 2251643003: Remove the BeginSaveFile and BeginDownload methods from ResourceDispatcherHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address next round of review comments and keep the download test in resource_dispatcher_host_unitteā€¦ Created 4 years, 3 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
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 30
31 namespace net { 31 namespace net {
32 class BoundNetLog; 32 class BoundNetLog;
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 41
41 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, 42 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager,
42 private DownloadItemImplDelegate { 43 private DownloadItemImplDelegate {
43 public: 44 public:
44 using DownloadItemImplCreated = base::Callback<void(DownloadItemImpl*)>; 45 using DownloadItemImplCreated = base::Callback<void(DownloadItemImpl*)>;
45 46
46 // Caller guarantees that |net_log| will remain valid 47 // Caller guarantees that |net_log| will remain valid
47 // for the lifetime of DownloadManagerImpl (until Shutdown() is called). 48 // for the lifetime of DownloadManagerImpl (until Shutdown() is called).
48 DownloadManagerImpl(net::NetLog* net_log, BrowserContext* browser_context); 49 DownloadManagerImpl(net::NetLog* net_log, BrowserContext* browser_context);
49 ~DownloadManagerImpl() override; 50 ~DownloadManagerImpl() override;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 114
114 // For testing; specifically, accessed from TestFileErrorInjector. 115 // For testing; specifically, accessed from TestFileErrorInjector.
115 void SetDownloadItemFactoryForTesting( 116 void SetDownloadItemFactoryForTesting(
116 std::unique_ptr<DownloadItemFactory> item_factory); 117 std::unique_ptr<DownloadItemFactory> item_factory);
117 void SetDownloadFileFactoryForTesting( 118 void SetDownloadFileFactoryForTesting(
118 std::unique_ptr<DownloadFileFactory> file_factory); 119 std::unique_ptr<DownloadFileFactory> file_factory);
119 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); 120 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting();
120 121
121 void RemoveUrlDownloader(UrlDownloader* downloader); 122 void RemoveUrlDownloader(UrlDownloader* downloader);
122 123
124 // Helper function to initiate a download request. This function initiates
125 // the download using functionality provided by the
126 // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns
127 // the result of the downoad operation. Please see the
128 // DownloadInterruptReason enum for information on possible return values.
129 static DownloadInterruptReason BeginDownloadRequest(
130 std::unique_ptr<net::URLRequest> url_request,
131 const Referrer& referrer,
132 ResourceContext* resource_context,
133 bool is_content_initiated,
134 int render_process_id,
135 int render_view_route_id,
136 int render_frame_route_id,
137 bool do_not_prompt_for_login);
138
123 private: 139 private:
124 using DownloadSet = std::set<DownloadItem*>; 140 using DownloadSet = std::set<DownloadItem*>;
125 using DownloadMap = std::unordered_map<uint32_t, DownloadItemImpl*>; 141 using DownloadMap = std::unordered_map<uint32_t, DownloadItemImpl*>;
126 using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>; 142 using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>;
127 using DownloadItemImplVector = std::vector<DownloadItemImpl*>; 143 using DownloadItemImplVector = std::vector<DownloadItemImpl*>;
128 using DownloadRemover = base::Callback<bool(const DownloadItemImpl*)>; 144 using DownloadRemover = base::Callback<bool(const DownloadItemImpl*)>;
129 145
130 // For testing. 146 // For testing.
131 friend class DownloadManagerTest; 147 friend class DownloadManagerTest;
132 friend class DownloadTest; 148 friend class DownloadTest;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 url_downloaders_; 238 url_downloaders_;
223 239
224 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; 240 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_;
225 241
226 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); 242 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl);
227 }; 243 };
228 244
229 } // namespace content 245 } // namespace content
230 246
231 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ 247 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698