| 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 24 matching lines...) Expand all Loading... |
| 35 // Caller guarantees that |net_log| will remain valid | 35 // Caller guarantees that |net_log| will remain valid |
| 36 // for the lifetime of DownloadManagerImpl (until Shutdown() is called). | 36 // for the lifetime of DownloadManagerImpl (until Shutdown() is called). |
| 37 DownloadManagerImpl(net::NetLog* net_log); | 37 DownloadManagerImpl(net::NetLog* net_log); |
| 38 | 38 |
| 39 // Implementation functions (not part of the DownloadManager interface). | 39 // Implementation functions (not part of the DownloadManager interface). |
| 40 | 40 |
| 41 // Creates a download item for the SavePackage system. | 41 // Creates a download item for the SavePackage system. |
| 42 // Must be called on the UI thread. Note that the DownloadManager | 42 // Must be called on the UI thread. Note that the DownloadManager |
| 43 // retains ownership. | 43 // retains ownership. |
| 44 virtual DownloadItemImpl* CreateSavePackageDownloadItem( | 44 virtual DownloadItemImpl* CreateSavePackageDownloadItem( |
| 45 const FilePath& main_file_path, | 45 const base::FilePath& main_file_path, |
| 46 const GURL& page_url, | 46 const GURL& page_url, |
| 47 const std::string& mime_type, | 47 const std::string& mime_type, |
| 48 DownloadItem::Observer* observer); | 48 DownloadItem::Observer* observer); |
| 49 | 49 |
| 50 // Notifies DownloadManager about a successful completion of |download_item|. | 50 // Notifies DownloadManager about a successful completion of |download_item|. |
| 51 void OnSavePackageSuccessfullyFinished(DownloadItem* download_item); | 51 void OnSavePackageSuccessfullyFinished(DownloadItem* download_item); |
| 52 | 52 |
| 53 // DownloadManager functions. | 53 // DownloadManager functions. |
| 54 virtual void SetDelegate(DownloadManagerDelegate* delegate) OVERRIDE; | 54 virtual void SetDelegate(DownloadManagerDelegate* delegate) OVERRIDE; |
| 55 virtual DownloadManagerDelegate* GetDelegate() const OVERRIDE; | 55 virtual DownloadManagerDelegate* GetDelegate() const OVERRIDE; |
| 56 virtual void Shutdown() OVERRIDE; | 56 virtual void Shutdown() OVERRIDE; |
| 57 virtual void GetAllDownloads(DownloadVector* result) OVERRIDE; | 57 virtual void GetAllDownloads(DownloadVector* result) OVERRIDE; |
| 58 virtual bool Init(BrowserContext* browser_context) OVERRIDE; | 58 virtual bool Init(BrowserContext* browser_context) OVERRIDE; |
| 59 virtual DownloadItem* StartDownload( | 59 virtual DownloadItem* StartDownload( |
| 60 scoped_ptr<DownloadCreateInfo> info, | 60 scoped_ptr<DownloadCreateInfo> info, |
| 61 scoped_ptr<ByteStreamReader> stream) OVERRIDE; | 61 scoped_ptr<ByteStreamReader> stream) OVERRIDE; |
| 62 virtual void CancelDownload(int32 download_id) OVERRIDE; | 62 virtual void CancelDownload(int32 download_id) OVERRIDE; |
| 63 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 63 virtual int RemoveDownloadsBetween(base::Time remove_begin, |
| 64 base::Time remove_end) OVERRIDE; | 64 base::Time remove_end) OVERRIDE; |
| 65 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; | 65 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; |
| 66 virtual int RemoveAllDownloads() OVERRIDE; | 66 virtual int RemoveAllDownloads() OVERRIDE; |
| 67 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; | 67 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; |
| 68 virtual void AddObserver(Observer* observer) OVERRIDE; | 68 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 69 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 69 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 70 virtual content::DownloadItem* CreateDownloadItem( | 70 virtual content::DownloadItem* CreateDownloadItem( |
| 71 const FilePath& current_path, | 71 const base::FilePath& current_path, |
| 72 const FilePath& target_path, | 72 const base::FilePath& target_path, |
| 73 const std::vector<GURL>& url_chain, | 73 const std::vector<GURL>& url_chain, |
| 74 const GURL& referrer_url, | 74 const GURL& referrer_url, |
| 75 const base::Time& start_time, | 75 const base::Time& start_time, |
| 76 const base::Time& end_time, | 76 const base::Time& end_time, |
| 77 int64 received_bytes, | 77 int64 received_bytes, |
| 78 int64 total_bytes, | 78 int64 total_bytes, |
| 79 content::DownloadItem::DownloadState state, | 79 content::DownloadItem::DownloadState state, |
| 80 DownloadDangerType danger_type, | 80 DownloadDangerType danger_type, |
| 81 DownloadInterruptReason interrupt_reason, | 81 DownloadInterruptReason interrupt_reason, |
| 82 bool opened) OVERRIDE; | 82 bool opened) OVERRIDE; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 // Remove from internal maps. | 122 // Remove from internal maps. |
| 123 int RemoveDownloadItems(const DownloadItemImplVector& pending_deletes); | 123 int RemoveDownloadItems(const DownloadItemImplVector& pending_deletes); |
| 124 | 124 |
| 125 // Overridden from DownloadItemImplDelegate | 125 // Overridden from DownloadItemImplDelegate |
| 126 // (Note that |GetBrowserContext| are present in both interfaces.) | 126 // (Note that |GetBrowserContext| are present in both interfaces.) |
| 127 virtual void DetermineDownloadTarget( | 127 virtual void DetermineDownloadTarget( |
| 128 DownloadItemImpl* item, const DownloadTargetCallback& callback) OVERRIDE; | 128 DownloadItemImpl* item, const DownloadTargetCallback& callback) OVERRIDE; |
| 129 virtual bool ShouldCompleteDownload( | 129 virtual bool ShouldCompleteDownload( |
| 130 DownloadItemImpl* item, const base::Closure& complete_callback) OVERRIDE; | 130 DownloadItemImpl* item, const base::Closure& complete_callback) OVERRIDE; |
| 131 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; | 131 virtual bool ShouldOpenFileBasedOnExtension( |
| 132 const base::FilePath& path) OVERRIDE; |
| 132 virtual bool ShouldOpenDownload( | 133 virtual bool ShouldOpenDownload( |
| 133 DownloadItemImpl* item, | 134 DownloadItemImpl* item, |
| 134 const ShouldOpenDownloadCallback& callback) OVERRIDE; | 135 const ShouldOpenDownloadCallback& callback) OVERRIDE; |
| 135 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; | 136 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; |
| 136 virtual void ResumeInterruptedDownload( | 137 virtual void ResumeInterruptedDownload( |
| 137 scoped_ptr<content::DownloadUrlParameters> params, | 138 scoped_ptr<content::DownloadUrlParameters> params, |
| 138 content::DownloadId id) OVERRIDE; | 139 content::DownloadId id) OVERRIDE; |
| 139 virtual void OpenDownload(DownloadItemImpl* download) OVERRIDE; | 140 virtual void OpenDownload(DownloadItemImpl* download) OVERRIDE; |
| 140 virtual void ShowDownloadInShell(DownloadItemImpl* download) OVERRIDE; | 141 virtual void ShowDownloadInShell(DownloadItemImpl* download) OVERRIDE; |
| 141 virtual void DownloadRemoved(DownloadItemImpl* download) OVERRIDE; | 142 virtual void DownloadRemoved(DownloadItemImpl* download) OVERRIDE; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 168 DownloadManagerDelegate* delegate_; | 169 DownloadManagerDelegate* delegate_; |
| 169 | 170 |
| 170 net::NetLog* net_log_; | 171 net::NetLog* net_log_; |
| 171 | 172 |
| 172 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 173 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
| 173 }; | 174 }; |
| 174 | 175 |
| 175 } // namespace content | 176 } // namespace content |
| 176 | 177 |
| 177 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 178 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| OLD | NEW |