| 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 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const base::FilePath& main_file_path, | 51 const base::FilePath& main_file_path, |
| 52 const GURL& page_url, | 52 const GURL& page_url, |
| 53 const std::string& mime_type, | 53 const std::string& mime_type, |
| 54 scoped_ptr<DownloadRequestHandleInterface> request_handle, | 54 scoped_ptr<DownloadRequestHandleInterface> request_handle, |
| 55 const DownloadItemImplCreated& item_created); | 55 const DownloadItemImplCreated& item_created); |
| 56 | 56 |
| 57 // Notifies DownloadManager about a successful completion of |download_item|. | 57 // Notifies DownloadManager about a successful completion of |download_item|. |
| 58 void OnSavePackageSuccessfullyFinished(DownloadItem* download_item); | 58 void OnSavePackageSuccessfullyFinished(DownloadItem* download_item); |
| 59 | 59 |
| 60 // DownloadManager functions. | 60 // DownloadManager functions. |
| 61 virtual void SetDelegate(DownloadManagerDelegate* delegate) OVERRIDE; | 61 virtual void SetDelegate(DownloadManagerDelegate* delegate) override; |
| 62 virtual DownloadManagerDelegate* GetDelegate() const OVERRIDE; | 62 virtual DownloadManagerDelegate* GetDelegate() const override; |
| 63 virtual void Shutdown() OVERRIDE; | 63 virtual void Shutdown() override; |
| 64 virtual void GetAllDownloads(DownloadVector* result) OVERRIDE; | 64 virtual void GetAllDownloads(DownloadVector* result) override; |
| 65 virtual void StartDownload( | 65 virtual void StartDownload( |
| 66 scoped_ptr<DownloadCreateInfo> info, | 66 scoped_ptr<DownloadCreateInfo> info, |
| 67 scoped_ptr<ByteStreamReader> stream, | 67 scoped_ptr<ByteStreamReader> stream, |
| 68 const DownloadUrlParameters::OnStartedCallback& on_started) OVERRIDE; | 68 const DownloadUrlParameters::OnStartedCallback& on_started) override; |
| 69 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 69 virtual int RemoveDownloadsBetween(base::Time remove_begin, |
| 70 base::Time remove_end) OVERRIDE; | 70 base::Time remove_end) override; |
| 71 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; | 71 virtual int RemoveDownloads(base::Time remove_begin) override; |
| 72 virtual int RemoveAllDownloads() OVERRIDE; | 72 virtual int RemoveAllDownloads() override; |
| 73 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; | 73 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) override; |
| 74 virtual void AddObserver(Observer* observer) OVERRIDE; | 74 virtual void AddObserver(Observer* observer) override; |
| 75 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 75 virtual void RemoveObserver(Observer* observer) override; |
| 76 virtual content::DownloadItem* CreateDownloadItem( | 76 virtual content::DownloadItem* CreateDownloadItem( |
| 77 uint32 id, | 77 uint32 id, |
| 78 const base::FilePath& current_path, | 78 const base::FilePath& current_path, |
| 79 const base::FilePath& target_path, | 79 const base::FilePath& target_path, |
| 80 const std::vector<GURL>& url_chain, | 80 const std::vector<GURL>& url_chain, |
| 81 const GURL& referrer_url, | 81 const GURL& referrer_url, |
| 82 const std::string& mime_type, | 82 const std::string& mime_type, |
| 83 const std::string& original_mime_type, | 83 const std::string& original_mime_type, |
| 84 const base::Time& start_time, | 84 const base::Time& start_time, |
| 85 const base::Time& end_time, | 85 const base::Time& end_time, |
| 86 const std::string& etag, | 86 const std::string& etag, |
| 87 const std::string& last_modified, | 87 const std::string& last_modified, |
| 88 int64 received_bytes, | 88 int64 received_bytes, |
| 89 int64 total_bytes, | 89 int64 total_bytes, |
| 90 content::DownloadItem::DownloadState state, | 90 content::DownloadItem::DownloadState state, |
| 91 DownloadDangerType danger_type, | 91 DownloadDangerType danger_type, |
| 92 DownloadInterruptReason interrupt_reason, | 92 DownloadInterruptReason interrupt_reason, |
| 93 bool opened) OVERRIDE; | 93 bool opened) override; |
| 94 virtual int InProgressCount() const OVERRIDE; | 94 virtual int InProgressCount() const override; |
| 95 virtual int NonMaliciousInProgressCount() const OVERRIDE; | 95 virtual int NonMaliciousInProgressCount() const override; |
| 96 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 96 virtual BrowserContext* GetBrowserContext() const override; |
| 97 virtual void CheckForHistoryFilesRemoval() OVERRIDE; | 97 virtual void CheckForHistoryFilesRemoval() override; |
| 98 virtual DownloadItem* GetDownload(uint32 id) OVERRIDE; | 98 virtual DownloadItem* GetDownload(uint32 id) override; |
| 99 | 99 |
| 100 // For testing; specifically, accessed from TestFileErrorInjector. | 100 // For testing; specifically, accessed from TestFileErrorInjector. |
| 101 void SetDownloadItemFactoryForTesting( | 101 void SetDownloadItemFactoryForTesting( |
| 102 scoped_ptr<DownloadItemFactory> item_factory); | 102 scoped_ptr<DownloadItemFactory> item_factory); |
| 103 void SetDownloadFileFactoryForTesting( | 103 void SetDownloadFileFactoryForTesting( |
| 104 scoped_ptr<DownloadFileFactory> file_factory); | 104 scoped_ptr<DownloadFileFactory> file_factory); |
| 105 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); | 105 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 typedef std::set<DownloadItem*> DownloadSet; | 108 typedef std::set<DownloadItem*> DownloadSet; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 138 void GetNextId(const DownloadIdCallback& callback); | 138 void GetNextId(const DownloadIdCallback& callback); |
| 139 | 139 |
| 140 // Called with the result of DownloadManagerDelegate::CheckForFileExistence. | 140 // Called with the result of DownloadManagerDelegate::CheckForFileExistence. |
| 141 // Updates the state of the file and then notifies this update to the file's | 141 // Updates the state of the file and then notifies this update to the file's |
| 142 // observer. | 142 // observer. |
| 143 void OnFileExistenceChecked(uint32 download_id, bool result); | 143 void OnFileExistenceChecked(uint32 download_id, bool result); |
| 144 | 144 |
| 145 // Overridden from DownloadItemImplDelegate | 145 // Overridden from DownloadItemImplDelegate |
| 146 // (Note that |GetBrowserContext| are present in both interfaces.) | 146 // (Note that |GetBrowserContext| are present in both interfaces.) |
| 147 virtual void DetermineDownloadTarget( | 147 virtual void DetermineDownloadTarget( |
| 148 DownloadItemImpl* item, const DownloadTargetCallback& callback) OVERRIDE; | 148 DownloadItemImpl* item, const DownloadTargetCallback& callback) override; |
| 149 virtual bool ShouldCompleteDownload( | 149 virtual bool ShouldCompleteDownload( |
| 150 DownloadItemImpl* item, const base::Closure& complete_callback) OVERRIDE; | 150 DownloadItemImpl* item, const base::Closure& complete_callback) override; |
| 151 virtual bool ShouldOpenFileBasedOnExtension( | 151 virtual bool ShouldOpenFileBasedOnExtension( |
| 152 const base::FilePath& path) OVERRIDE; | 152 const base::FilePath& path) override; |
| 153 virtual bool ShouldOpenDownload( | 153 virtual bool ShouldOpenDownload( |
| 154 DownloadItemImpl* item, | 154 DownloadItemImpl* item, |
| 155 const ShouldOpenDownloadCallback& callback) OVERRIDE; | 155 const ShouldOpenDownloadCallback& callback) override; |
| 156 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; | 156 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) override; |
| 157 virtual void ResumeInterruptedDownload( | 157 virtual void ResumeInterruptedDownload( |
| 158 scoped_ptr<content::DownloadUrlParameters> params, | 158 scoped_ptr<content::DownloadUrlParameters> params, |
| 159 uint32 id) OVERRIDE; | 159 uint32 id) override; |
| 160 virtual void OpenDownload(DownloadItemImpl* download) OVERRIDE; | 160 virtual void OpenDownload(DownloadItemImpl* download) override; |
| 161 virtual void ShowDownloadInShell(DownloadItemImpl* download) OVERRIDE; | 161 virtual void ShowDownloadInShell(DownloadItemImpl* download) override; |
| 162 virtual void DownloadRemoved(DownloadItemImpl* download) OVERRIDE; | 162 virtual void DownloadRemoved(DownloadItemImpl* download) override; |
| 163 | 163 |
| 164 // Factory for creation of downloads items. | 164 // Factory for creation of downloads items. |
| 165 scoped_ptr<DownloadItemFactory> item_factory_; | 165 scoped_ptr<DownloadItemFactory> item_factory_; |
| 166 | 166 |
| 167 // Factory for the creation of download files. | 167 // Factory for the creation of download files. |
| 168 scoped_ptr<DownloadFileFactory> file_factory_; | 168 scoped_ptr<DownloadFileFactory> file_factory_; |
| 169 | 169 |
| 170 // |downloads_| is the owning set for all downloads known to the | 170 // |downloads_| is the owning set for all downloads known to the |
| 171 // DownloadManager. This includes downloads started by the user in | 171 // DownloadManager. This includes downloads started by the user in |
| 172 // this session, downloads initialized from the history system, and | 172 // this session, downloads initialized from the history system, and |
| (...skipping 17 matching lines...) Expand all Loading... |
| 190 net::NetLog* net_log_; | 190 net::NetLog* net_log_; |
| 191 | 191 |
| 192 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; | 192 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; |
| 193 | 193 |
| 194 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 194 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 } // namespace content | 197 } // namespace content |
| 198 | 198 |
| 199 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 199 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| OLD | NEW |