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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 scoped_ptr<ByteStreamReader> stream) OVERRIDE; | 58 scoped_ptr<ByteStreamReader> stream) OVERRIDE; |
59 virtual void CancelDownload(int32 download_id) OVERRIDE; | 59 virtual void CancelDownload(int32 download_id) OVERRIDE; |
60 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 60 virtual int RemoveDownloadsBetween(base::Time remove_begin, |
61 base::Time remove_end) OVERRIDE; | 61 base::Time remove_end) OVERRIDE; |
62 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; | 62 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; |
63 virtual int RemoveAllDownloads() OVERRIDE; | 63 virtual int RemoveAllDownloads() OVERRIDE; |
64 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; | 64 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; |
65 virtual void AddObserver(Observer* observer) OVERRIDE; | 65 virtual void AddObserver(Observer* observer) OVERRIDE; |
66 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 66 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
67 virtual content::DownloadItem* CreateDownloadItem( | 67 virtual content::DownloadItem* CreateDownloadItem( |
68 const FilePath& path, | 68 const FilePath& current_path, |
69 const GURL& url, | 69 const FilePath& target_path, |
| 70 const std::vector<GURL>& url_chain, |
70 const GURL& referrer_url, | 71 const GURL& referrer_url, |
71 const base::Time& start_time, | 72 const base::Time& start_time, |
72 const base::Time& end_time, | 73 const base::Time& end_time, |
73 int64 received_bytes, | 74 int64 received_bytes, |
74 int64 total_bytes, | 75 int64 total_bytes, |
75 content::DownloadItem::DownloadState state, | 76 content::DownloadItem::DownloadState state, |
| 77 DownloadDangerType danger_type, |
| 78 DownloadInterruptReason interrupt_reason, |
76 bool opened) OVERRIDE; | 79 bool opened) OVERRIDE; |
77 virtual int InProgressCount() const OVERRIDE; | 80 virtual int InProgressCount() const OVERRIDE; |
78 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 81 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
79 virtual void CheckForHistoryFilesRemoval() OVERRIDE; | 82 virtual void CheckForHistoryFilesRemoval() OVERRIDE; |
80 virtual DownloadItem* GetDownload(int id) OVERRIDE; | 83 virtual DownloadItem* GetDownload(int id) OVERRIDE; |
81 | 84 |
82 // For testing; specifically, accessed from TestFileErrorInjector. | 85 // For testing; specifically, accessed from TestFileErrorInjector. |
83 void SetDownloadItemFactoryForTesting( | 86 void SetDownloadItemFactoryForTesting( |
84 scoped_ptr<DownloadItemFactory> item_factory); | 87 scoped_ptr<DownloadItemFactory> item_factory); |
85 void SetDownloadFileFactoryForTesting( | 88 void SetDownloadFileFactoryForTesting( |
86 scoped_ptr<DownloadFileFactory> file_factory); | 89 scoped_ptr<DownloadFileFactory> file_factory); |
87 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); | 90 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); |
88 | 91 |
89 private: | 92 private: |
90 typedef std::set<DownloadItem*> DownloadSet; | 93 typedef std::set<DownloadItem*> DownloadSet; |
91 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap; | 94 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap; |
92 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; | 95 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; |
93 | 96 |
94 // For testing. | 97 // For testing. |
95 friend class DownloadManagerTest; | 98 friend class DownloadManagerTest; |
96 friend class DownloadTest; | 99 friend class DownloadTest; |
97 | 100 |
98 friend class base::RefCountedThreadSafe<DownloadManagerImpl>; | 101 friend class base::RefCountedThreadSafe<DownloadManagerImpl>; |
99 | 102 |
100 virtual ~DownloadManagerImpl(); | 103 virtual ~DownloadManagerImpl(); |
101 | 104 |
102 // Retrieves the download item corresponding to the passed | 105 // Retrieves the download item corresponding to the passed |
103 // DownloadCreateInfo. This will create the download item | 106 // DownloadCreateInfo (generated on the IO thread). This will create |
104 // if this is a new download (common case) or retrieve an | 107 // the download item if this is a new download (common case) or retrieve an |
105 // existing download item if this is a resuming download. | 108 // existing download item if this is a resuming download. |
106 virtual DownloadItemImpl* GetOrCreateDownloadItem(DownloadCreateInfo* info); | 109 virtual DownloadItemImpl* GetOrCreateDownloadItem(DownloadCreateInfo* info); |
107 | 110 |
108 // Get next download id. | 111 // Get next download id. |
109 DownloadId GetNextId(); | 112 DownloadId GetNextId(); |
110 | 113 |
111 // Called on the FILE thread to check the existence of a downloaded file. | 114 // Called on the FILE thread to check the existence of a downloaded file. |
112 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); | 115 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); |
113 | 116 |
114 // Called on the UI thread if the FILE thread detects the removal of | 117 // Called on the UI thread if the FILE thread detects the removal of |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 DownloadManagerDelegate* delegate_; | 167 DownloadManagerDelegate* delegate_; |
165 | 168 |
166 net::NetLog* net_log_; | 169 net::NetLog* net_log_; |
167 | 170 |
168 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 171 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
169 }; | 172 }; |
170 | 173 |
171 } // namespace content | 174 } // namespace content |
172 | 175 |
173 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 176 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |