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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const Referrer& referrer, | 131 const Referrer& referrer, |
132 ResourceContext* resource_context, | 132 ResourceContext* resource_context, |
133 bool is_content_initiated, | 133 bool is_content_initiated, |
134 int render_process_id, | 134 int render_process_id, |
135 int render_view_route_id, | 135 int render_view_route_id, |
136 int render_frame_route_id, | 136 int render_frame_route_id, |
137 bool do_not_prompt_for_login); | 137 bool do_not_prompt_for_login); |
138 | 138 |
139 private: | 139 private: |
140 using DownloadSet = std::set<DownloadItem*>; | 140 using DownloadSet = std::set<DownloadItem*>; |
141 using DownloadMap = std::unordered_map<uint32_t, DownloadItemImpl*>; | |
142 using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>; | 141 using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>; |
143 using DownloadItemImplVector = std::vector<DownloadItemImpl*>; | 142 using DownloadItemImplVector = std::vector<DownloadItemImpl*>; |
144 using DownloadRemover = base::Callback<bool(const DownloadItemImpl*)>; | 143 using DownloadRemover = base::Callback<bool(const DownloadItemImpl*)>; |
145 | 144 |
146 // For testing. | 145 // For testing. |
147 friend class DownloadManagerTest; | 146 friend class DownloadManagerTest; |
148 friend class DownloadTest; | 147 friend class DownloadTest; |
149 | 148 |
150 void StartDownloadWithId( | 149 void StartDownloadWithId( |
151 std::unique_ptr<DownloadCreateInfo> info, | 150 std::unique_ptr<DownloadCreateInfo> info, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 205 |
207 // Factory for the creation of download files. | 206 // Factory for the creation of download files. |
208 std::unique_ptr<DownloadFileFactory> file_factory_; | 207 std::unique_ptr<DownloadFileFactory> file_factory_; |
209 | 208 |
210 // |downloads_| is the owning set for all downloads known to the | 209 // |downloads_| is the owning set for all downloads known to the |
211 // DownloadManager. This includes downloads started by the user in | 210 // DownloadManager. This includes downloads started by the user in |
212 // this session, downloads initialized from the history system, and | 211 // this session, downloads initialized from the history system, and |
213 // "save page as" downloads. | 212 // "save page as" downloads. |
214 // TODO(asanka): Remove this container in favor of downloads_by_guid_ as a | 213 // TODO(asanka): Remove this container in favor of downloads_by_guid_ as a |
215 // part of http://crbug.com/593020. | 214 // part of http://crbug.com/593020. |
216 DownloadMap downloads_; | 215 std::unordered_map<uint32_t, std::unique_ptr<DownloadItemImpl>> downloads_; |
217 | 216 |
218 // Same as the above, but maps from GUID to download item. Note that the | 217 // Same as the above, but maps from GUID to download item. Note that the |
219 // container is case sensitive. Hence the key needs to be normalized to | 218 // container is case sensitive. Hence the key needs to be normalized to |
220 // upper-case when inserting new elements here. Fortunately for us, | 219 // upper-case when inserting new elements here. Fortunately for us, |
221 // DownloadItemImpl already normalizes the string GUID. | 220 // DownloadItemImpl already normalizes the string GUID. |
222 DownloadGuidMap downloads_by_guid_; | 221 DownloadGuidMap downloads_by_guid_; |
223 | 222 |
224 // True if the download manager has been initialized and requires a shutdown. | 223 // True if the download manager has been initialized and requires a shutdown. |
225 bool shutdown_needed_; | 224 bool shutdown_needed_; |
226 | 225 |
(...skipping 12 matching lines...) Expand all Loading... |
239 url_downloaders_; | 238 url_downloaders_; |
240 | 239 |
241 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; | 240 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; |
242 | 241 |
243 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 242 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
244 }; | 243 }; |
245 | 244 |
246 } // namespace content | 245 } // namespace content |
247 | 246 |
248 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 247 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |