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 | 5 |
6 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 6 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
7 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 7 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
8 #pragma once | 8 #pragma once |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/message_loop_helpers.h" | 17 #include "base/message_loop_helpers.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "content/browser/download/download_item_impl.h" | 20 #include "content/browser/download/download_item_impl.h" |
21 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
22 #include "content/public/browser/download_manager.h" | 22 #include "content/public/browser/download_manager.h" |
23 | 23 |
24 class CONTENT_EXPORT DownloadManagerImpl | 24 class CONTENT_EXPORT DownloadManagerImpl |
25 : public content::DownloadManager, | 25 : public content::DownloadManager, |
26 public DownloadItemImpl::Delegate { | 26 public DownloadItemImpl::Delegate { |
27 public: | 27 public: |
28 DownloadManagerImpl(content::DownloadManagerDelegate* delegate); | 28 DownloadManagerImpl(content::DownloadManagerDelegate* delegate, |
| 29 net::NetLog* net_log); |
29 | 30 |
30 // content::DownloadManager functions. | 31 // content::DownloadManager functions. |
31 virtual void Shutdown() OVERRIDE; | 32 virtual void Shutdown() OVERRIDE; |
32 virtual void GetTemporaryDownloads(const FilePath& dir_path, | 33 virtual void GetTemporaryDownloads(const FilePath& dir_path, |
33 DownloadVector* result) OVERRIDE; | 34 DownloadVector* result) OVERRIDE; |
34 virtual void GetAllDownloads(const FilePath& dir_path, | 35 virtual void GetAllDownloads(const FilePath& dir_path, |
35 DownloadVector* result) OVERRIDE; | 36 DownloadVector* result) OVERRIDE; |
36 virtual void SearchDownloads(const string16& query, | 37 virtual void SearchDownloads(const string16& query, |
37 DownloadVector* result) OVERRIDE; | 38 DownloadVector* result) OVERRIDE; |
38 virtual bool Init(content::BrowserContext* browser_context) OVERRIDE; | 39 virtual bool Init(content::BrowserContext* browser_context) OVERRIDE; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 173 |
173 // Remove from internal maps. | 174 // Remove from internal maps. |
174 int RemoveDownloadItems(const DownloadVector& pending_deletes); | 175 int RemoveDownloadItems(const DownloadVector& pending_deletes); |
175 | 176 |
176 // Called when a download entry is committed to the persistent store. | 177 // Called when a download entry is committed to the persistent store. |
177 void OnDownloadItemAddedToPersistentStore(int32 download_id, int64 db_handle); | 178 void OnDownloadItemAddedToPersistentStore(int32 download_id, int64 db_handle); |
178 | 179 |
179 // Called when Save Page As entry is committed to the persistent store. | 180 // Called when Save Page As entry is committed to the persistent store. |
180 void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle); | 181 void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle); |
181 | 182 |
| 183 virtual net::NetLog* GetNetLog(); |
| 184 |
182 // For unit tests only. | 185 // For unit tests only. |
183 virtual void SetFileManager(DownloadFileManager* file_manager) OVERRIDE; | 186 virtual void SetFileManager(DownloadFileManager* file_manager) OVERRIDE; |
184 | 187 |
185 // |downloads_| is the owning set for all downloads known to the | 188 // |downloads_| is the owning set for all downloads known to the |
186 // DownloadManager. This includes downloads started by the user in | 189 // DownloadManager. This includes downloads started by the user in |
187 // this session, downloads initialized from the history system, and | 190 // this session, downloads initialized from the history system, and |
188 // "save page as" downloads. All other DownloadItem containers in | 191 // "save page as" downloads. All other DownloadItem containers in |
189 // the DownloadManager are maps; they do not own the DownloadItems. | 192 // the DownloadManager are maps; they do not own the DownloadItems. |
190 // Note that this is the only place (with any functional implications; | 193 // Note that this is the only place (with any functional implications; |
191 // see save_page_downloads_ below) that "save page as" downloads are | 194 // see save_page_downloads_ below) that "save page as" downloads are |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // user wants us to prompt for a save location for each download. | 245 // user wants us to prompt for a save location for each download. |
243 FilePath last_download_path_; | 246 FilePath last_download_path_; |
244 | 247 |
245 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 248 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
246 content::DownloadManagerDelegate* delegate_; | 249 content::DownloadManagerDelegate* delegate_; |
247 | 250 |
248 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. | 251 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. |
249 // For debugging only. | 252 // For debugging only. |
250 int64 largest_db_handle_in_history_; | 253 int64 largest_db_handle_in_history_; |
251 | 254 |
| 255 net::NetLog* net_log_; |
| 256 |
252 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 257 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
253 }; | 258 }; |
254 | 259 |
255 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 260 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |