| 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 #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 20 matching lines...) Expand all Loading... |
| 31 namespace net { | 31 namespace net { |
| 32 class NetLog; | 32 class NetLog; |
| 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 class ServiceWorkerContextWrapper; |
| 41 | 42 |
| 42 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, | 43 class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, |
| 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; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 // Helper function to initiate a download request. This function initiates | 125 // Helper function to initiate a download request. This function initiates |
| 125 // the download using functionality provided by the | 126 // the download using functionality provided by the |
| 126 // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns | 127 // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns |
| 127 // the result of the downoad operation. Please see the | 128 // the result of the downoad operation. Please see the |
| 128 // DownloadInterruptReason enum for information on possible return values. | 129 // DownloadInterruptReason enum for information on possible return values. |
| 129 static DownloadInterruptReason BeginDownloadRequest( | 130 static DownloadInterruptReason BeginDownloadRequest( |
| 130 std::unique_ptr<net::URLRequest> url_request, | 131 std::unique_ptr<net::URLRequest> url_request, |
| 131 const Referrer& referrer, | 132 const Referrer& referrer, |
| 132 ResourceContext* resource_context, | 133 ResourceContext* resource_context, |
| 134 ServiceWorkerContextWrapper* service_worker_context, |
| 133 bool is_content_initiated, | 135 bool is_content_initiated, |
| 134 int render_process_id, | 136 int render_process_id, |
| 135 int render_view_route_id, | 137 int render_view_route_id, |
| 136 int render_frame_route_id, | 138 int render_frame_route_id, |
| 139 int service_worker_provider_id, |
| 137 bool do_not_prompt_for_login); | 140 bool do_not_prompt_for_login); |
| 138 | 141 |
| 139 private: | 142 private: |
| 140 using DownloadSet = std::set<DownloadItem*>; | 143 using DownloadSet = std::set<DownloadItem*>; |
| 141 using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>; | 144 using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>; |
| 142 using DownloadItemImplVector = std::vector<DownloadItemImpl*>; | 145 using DownloadItemImplVector = std::vector<DownloadItemImpl*>; |
| 143 using DownloadRemover = base::Callback<bool(const DownloadItemImpl*)>; | 146 using DownloadRemover = base::Callback<bool(const DownloadItemImpl*)>; |
| 144 | 147 |
| 145 // For testing. | 148 // For testing. |
| 146 friend class DownloadManagerTest; | 149 friend class DownloadManagerTest; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 url_downloaders_; | 241 url_downloaders_; |
| 239 | 242 |
| 240 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; | 243 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; |
| 241 | 244 |
| 242 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 245 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
| 243 }; | 246 }; |
| 244 | 247 |
| 245 } // namespace content | 248 } // namespace content |
| 246 | 249 |
| 247 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 250 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| OLD | NEW |