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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 int32 download_id, | 72 int32 download_id, |
73 content::DownloadInterruptReason reason) OVERRIDE; | 73 content::DownloadInterruptReason reason) OVERRIDE; |
74 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 74 virtual int RemoveDownloadsBetween(base::Time remove_begin, |
75 base::Time remove_end) OVERRIDE; | 75 base::Time remove_end) OVERRIDE; |
76 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; | 76 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; |
77 virtual int RemoveAllDownloads() OVERRIDE; | 77 virtual int RemoveAllDownloads() OVERRIDE; |
78 virtual void DownloadUrl( | 78 virtual void DownloadUrl( |
79 scoped_ptr<content::DownloadUrlParameters> params) OVERRIDE; | 79 scoped_ptr<content::DownloadUrlParameters> params) OVERRIDE; |
80 virtual void AddObserver(Observer* observer) OVERRIDE; | 80 virtual void AddObserver(Observer* observer) OVERRIDE; |
81 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 81 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
82 virtual void OnPersistentStoreQueryComplete( | 82 virtual content::DownloadItem* CreateDownloadItem( |
83 std::vector<content::DownloadPersistentStoreInfo>* entries) OVERRIDE; | 83 const FilePath& path, |
84 virtual void OnItemAddedToPersistentStore(int32 download_id, | 84 const GURL& url, |
85 int64 db_handle) OVERRIDE; | 85 const GURL& referrer_url, |
| 86 const base::Time& start_time, |
| 87 const base::Time& end_time, |
| 88 int64 received_bytes, |
| 89 int64 total_bytes, |
| 90 content::DownloadItem::DownloadState state, |
| 91 bool opened) OVERRIDE; |
86 virtual int InProgressCount() const OVERRIDE; | 92 virtual int InProgressCount() const OVERRIDE; |
87 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; | 93 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
88 virtual void CheckForHistoryFilesRemoval() OVERRIDE; | 94 virtual void CheckForHistoryFilesRemoval() OVERRIDE; |
89 virtual content::DownloadItem* GetDownloadItem(int id) OVERRIDE; | 95 virtual content::DownloadItem* GetDownloadItem(int id) OVERRIDE; |
90 virtual content::DownloadItem* GetDownload(int id) OVERRIDE; | 96 virtual content::DownloadItem* GetDownload(int id) OVERRIDE; |
91 virtual void SavePageDownloadFinished( | 97 virtual void SavePageDownloadFinished( |
92 content::DownloadItem* download) OVERRIDE; | 98 content::DownloadItem* download) OVERRIDE; |
93 virtual content::DownloadItem* GetActiveDownloadItem(int id) OVERRIDE; | 99 virtual content::DownloadItem* GetActiveDownloadItem(int id) OVERRIDE; |
94 virtual bool GenerateFileHash() OVERRIDE; | 100 virtual bool GenerateFileHash() OVERRIDE; |
95 | 101 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Does nothing if the download is not in the history DB. | 143 // Does nothing if the download is not in the history DB. |
138 void RemoveFromActiveList(DownloadItemImpl* download); | 144 void RemoveFromActiveList(DownloadItemImpl* download); |
139 | 145 |
140 // Inform observers that the model has changed. | 146 // Inform observers that the model has changed. |
141 void NotifyModelChanged(); | 147 void NotifyModelChanged(); |
142 | 148 |
143 // Debugging routine to confirm relationship between below | 149 // Debugging routine to confirm relationship between below |
144 // containers; no-op if NDEBUG. | 150 // containers; no-op if NDEBUG. |
145 void AssertContainersConsistent() const; | 151 void AssertContainersConsistent() const; |
146 | 152 |
147 // Add a DownloadItem to history_downloads_. | |
148 void AddDownloadItemToHistory(DownloadItemImpl* item, int64 db_handle); | |
149 | |
150 // Remove from internal maps. | 153 // Remove from internal maps. |
151 int RemoveDownloadItems(const DownloadItemImplVector& pending_deletes); | 154 int RemoveDownloadItems(const DownloadItemImplVector& pending_deletes); |
152 | 155 |
153 // Called in response to our request to the DownloadFileManager to | 156 // Called in response to our request to the DownloadFileManager to |
154 // create a DownloadFile. A |reason| of | 157 // create a DownloadFile. A |reason| of |
155 // content::DOWNLOAD_INTERRUPT_REASON_NONE indicates success. | 158 // content::DOWNLOAD_INTERRUPT_REASON_NONE indicates success. |
156 void OnDownloadFileCreated( | 159 void OnDownloadFileCreated( |
157 int32 download_id, content::DownloadInterruptReason reason); | 160 int32 download_id, content::DownloadInterruptReason reason); |
158 | 161 |
159 // Called when the delegate has completed determining the download target. | 162 // Called when the delegate has completed determining the download target. |
160 // Arguments following |download_id| are as per | 163 // Arguments following |download_id| are as per |
161 // content::DownloadTargetCallback. | 164 // content::DownloadTargetCallback. |
162 void OnDownloadTargetDetermined( | 165 void OnDownloadTargetDetermined( |
163 int32 download_id, | 166 int32 download_id, |
164 const FilePath& target_path, | 167 const FilePath& target_path, |
165 content::DownloadItem::TargetDisposition disposition, | 168 content::DownloadItem::TargetDisposition disposition, |
166 content::DownloadDangerType danger_type, | 169 content::DownloadDangerType danger_type, |
167 const FilePath& intermediate_path); | 170 const FilePath& intermediate_path); |
168 | 171 |
169 // Called when a download entry is committed to the persistent store. | |
170 void OnDownloadItemAddedToPersistentStore(DownloadItemImpl* item); | |
171 | |
172 // Called when Save Page As entry is committed to the persistent store. | |
173 void OnSavePageItemAddedToPersistentStore(DownloadItemImpl* item); | |
174 | |
175 // Overridden from DownloadItemImplDelegate | 172 // Overridden from DownloadItemImplDelegate |
176 // (Note that |GetBrowserContext| are present in both interfaces.) | 173 // (Note that |GetBrowserContext| are present in both interfaces.) |
177 virtual DownloadFileManager* GetDownloadFileManager() OVERRIDE; | 174 virtual DownloadFileManager* GetDownloadFileManager() OVERRIDE; |
178 virtual bool ShouldOpenDownload(DownloadItemImpl* item) OVERRIDE; | 175 virtual bool ShouldOpenDownload(DownloadItemImpl* item) OVERRIDE; |
179 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; | 176 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; |
180 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; | 177 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; |
181 virtual void MaybeCompleteDownload(DownloadItemImpl* download) OVERRIDE; | 178 virtual void MaybeCompleteDownload(DownloadItemImpl* download) OVERRIDE; |
182 virtual void DownloadStopped(DownloadItemImpl* download) OVERRIDE; | 179 virtual void DownloadStopped(DownloadItemImpl* download) OVERRIDE; |
183 virtual void DownloadCompleted(DownloadItemImpl* download) OVERRIDE; | 180 virtual void DownloadCompleted(DownloadItemImpl* download) OVERRIDE; |
184 virtual void DownloadOpened(DownloadItemImpl* download) OVERRIDE; | 181 virtual void DownloadOpened(DownloadItemImpl* download) OVERRIDE; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 229 |
233 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 230 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
234 content::DownloadManagerDelegate* delegate_; | 231 content::DownloadManagerDelegate* delegate_; |
235 | 232 |
236 net::NetLog* net_log_; | 233 net::NetLog* net_log_; |
237 | 234 |
238 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 235 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
239 }; | 236 }; |
240 | 237 |
241 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 238 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |