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 25 matching lines...) Expand all Loading... |
64 content::WebContents* web_contents) OVERRIDE; | 65 content::WebContents* web_contents) OVERRIDE; |
65 virtual void AddObserver(Observer* observer) OVERRIDE; | 66 virtual void AddObserver(Observer* observer) OVERRIDE; |
66 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 67 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
67 virtual void OnPersistentStoreQueryComplete( | 68 virtual void OnPersistentStoreQueryComplete( |
68 std::vector<DownloadPersistentStoreInfo>* entries) OVERRIDE; | 69 std::vector<DownloadPersistentStoreInfo>* entries) OVERRIDE; |
69 virtual void OnItemAddedToPersistentStore(int32 download_id, | 70 virtual void OnItemAddedToPersistentStore(int32 download_id, |
70 int64 db_handle) OVERRIDE; | 71 int64 db_handle) OVERRIDE; |
71 virtual int InProgressCount() const OVERRIDE; | 72 virtual int InProgressCount() const OVERRIDE; |
72 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; | 73 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
73 virtual FilePath LastDownloadPath() OVERRIDE; | 74 virtual FilePath LastDownloadPath() OVERRIDE; |
74 virtual void CreateDownloadItem( | 75 virtual net::BoundNetLog CreateDownloadItem( |
75 DownloadCreateInfo* info, | 76 DownloadCreateInfo* info, |
76 const DownloadRequestHandle& request_handle) OVERRIDE; | 77 const DownloadRequestHandle& request_handle) OVERRIDE; |
77 virtual content::DownloadItem* CreateSavePackageDownloadItem( | 78 virtual content::DownloadItem* CreateSavePackageDownloadItem( |
78 const FilePath& main_file_path, | 79 const FilePath& main_file_path, |
79 const GURL& page_url, | 80 const GURL& page_url, |
80 bool is_otr, | 81 bool is_otr, |
81 content::DownloadItem::Observer* observer) OVERRIDE; | 82 content::DownloadItem::Observer* observer) OVERRIDE; |
82 virtual void ClearLastDownloadPath() OVERRIDE; | 83 virtual void ClearLastDownloadPath() OVERRIDE; |
83 virtual void FileSelected(const FilePath& path, void* params) OVERRIDE; | 84 virtual void FileSelected(const FilePath& path, void* params) OVERRIDE; |
84 virtual void FileSelectionCanceled(void* params) OVERRIDE; | 85 virtual void FileSelectionCanceled(void* params) OVERRIDE; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // user wants us to prompt for a save location for each download. | 244 // user wants us to prompt for a save location for each download. |
244 FilePath last_download_path_; | 245 FilePath last_download_path_; |
245 | 246 |
246 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 247 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
247 content::DownloadManagerDelegate* delegate_; | 248 content::DownloadManagerDelegate* delegate_; |
248 | 249 |
249 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. | 250 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. |
250 // For debugging only. | 251 // For debugging only. |
251 int64 largest_db_handle_in_history_; | 252 int64 largest_db_handle_in_history_; |
252 | 253 |
| 254 net::NetLog* net_log_; |
| 255 |
253 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 256 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
254 }; | 257 }; |
255 | 258 |
256 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 259 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |