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