| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const base::Time& start_time, | 71 const base::Time& start_time, |
| 72 const base::Time& end_time, | 72 const base::Time& end_time, |
| 73 int64 received_bytes, | 73 int64 received_bytes, |
| 74 int64 total_bytes, | 74 int64 total_bytes, |
| 75 content::DownloadItem::DownloadState state, | 75 content::DownloadItem::DownloadState state, |
| 76 bool opened) OVERRIDE; | 76 bool opened) OVERRIDE; |
| 77 virtual int InProgressCount() const OVERRIDE; | 77 virtual int InProgressCount() const OVERRIDE; |
| 78 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 78 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
| 79 virtual void CheckForHistoryFilesRemoval() OVERRIDE; | 79 virtual void CheckForHistoryFilesRemoval() OVERRIDE; |
| 80 virtual DownloadItem* GetDownload(int id) OVERRIDE; | 80 virtual DownloadItem* GetDownload(int id) OVERRIDE; |
| 81 virtual void MockDownloadOpenForTesting() OVERRIDE; |
| 81 | 82 |
| 82 // For testing; specifically, accessed from TestFileErrorInjector. | 83 // For testing; specifically, accessed from TestFileErrorInjector. |
| 83 void SetDownloadItemFactoryForTesting( | 84 void SetDownloadItemFactoryForTesting( |
| 84 scoped_ptr<DownloadItemFactory> item_factory); | 85 scoped_ptr<DownloadItemFactory> item_factory); |
| 85 void SetDownloadFileFactoryForTesting( | 86 void SetDownloadFileFactoryForTesting( |
| 86 scoped_ptr<DownloadFileFactory> file_factory); | 87 scoped_ptr<DownloadFileFactory> file_factory); |
| 87 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); | 88 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); |
| 88 | 89 |
| 89 private: | 90 private: |
| 90 typedef std::set<DownloadItem*> DownloadSet; | 91 typedef std::set<DownloadItem*> DownloadSet; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 virtual bool ShouldCompleteDownload( | 127 virtual bool ShouldCompleteDownload( |
| 127 DownloadItemImpl* item, const base::Closure& complete_callback) OVERRIDE; | 128 DownloadItemImpl* item, const base::Closure& complete_callback) OVERRIDE; |
| 128 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; | 129 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; |
| 129 virtual bool ShouldOpenDownload( | 130 virtual bool ShouldOpenDownload( |
| 130 DownloadItemImpl* item, | 131 DownloadItemImpl* item, |
| 131 const ShouldOpenDownloadCallback& callback) OVERRIDE; | 132 const ShouldOpenDownloadCallback& callback) OVERRIDE; |
| 132 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; | 133 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; |
| 133 virtual void ResumeInterruptedDownload( | 134 virtual void ResumeInterruptedDownload( |
| 134 scoped_ptr<content::DownloadUrlParameters> params, | 135 scoped_ptr<content::DownloadUrlParameters> params, |
| 135 content::DownloadId id) OVERRIDE; | 136 content::DownloadId id) OVERRIDE; |
| 136 virtual void DownloadOpened(DownloadItemImpl* download) OVERRIDE; | 137 virtual void OpenDownload(DownloadItemImpl* download) OVERRIDE; |
| 138 virtual void ShowDownloadInShell(DownloadItemImpl* download) OVERRIDE; |
| 137 virtual void DownloadRemoved(DownloadItemImpl* download) OVERRIDE; | 139 virtual void DownloadRemoved(DownloadItemImpl* download) OVERRIDE; |
| 138 virtual void ShowDownloadInBrowser(DownloadItemImpl* download) OVERRIDE; | 140 virtual void ShowDownloadInBrowser(DownloadItemImpl* download) OVERRIDE; |
| 139 | 141 |
| 140 // Factory for creation of downloads items. | 142 // Factory for creation of downloads items. |
| 141 scoped_ptr<DownloadItemFactory> item_factory_; | 143 scoped_ptr<DownloadItemFactory> item_factory_; |
| 142 | 144 |
| 143 // Factory for the creation of download files. | 145 // Factory for the creation of download files. |
| 144 scoped_ptr<DownloadFileFactory> file_factory_; | 146 scoped_ptr<DownloadFileFactory> file_factory_; |
| 145 | 147 |
| 146 // |downloads_| is the owning set for all downloads known to the | 148 // |downloads_| is the owning set for all downloads known to the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 158 ObserverList<Observer> observers_; | 160 ObserverList<Observer> observers_; |
| 159 | 161 |
| 160 // The current active browser context. | 162 // The current active browser context. |
| 161 BrowserContext* browser_context_; | 163 BrowserContext* browser_context_; |
| 162 | 164 |
| 163 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 165 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
| 164 DownloadManagerDelegate* delegate_; | 166 DownloadManagerDelegate* delegate_; |
| 165 | 167 |
| 166 net::NetLog* net_log_; | 168 net::NetLog* net_log_; |
| 167 | 169 |
| 170 // Do we actually open downloads when requested? For testing purposes only. |
| 171 bool open_enabled_; |
| 172 |
| 168 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 173 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
| 169 }; | 174 }; |
| 170 | 175 |
| 171 } // namespace content | 176 } // namespace content |
| 172 | 177 |
| 173 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 178 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| OLD | NEW |