Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 | 59 |
| 60 // DownloadManager functions. | 60 // DownloadManager functions. |
| 61 void SetDelegate(DownloadManagerDelegate* delegate) override; | 61 void SetDelegate(DownloadManagerDelegate* delegate) override; |
| 62 DownloadManagerDelegate* GetDelegate() const override; | 62 DownloadManagerDelegate* GetDelegate() const override; |
| 63 void Shutdown() override; | 63 void Shutdown() override; |
| 64 void GetAllDownloads(DownloadVector* result) override; | 64 void GetAllDownloads(DownloadVector* result) override; |
| 65 void StartDownload( | 65 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 int RemoveDownloadsBetween(base::Time remove_begin, | 69 int RemoveDownloadsBetween(const std::set<GURL>& restricted_urls, |
|
Mike West
2015/07/22 20:16:03
Rename here as well (and I still don't understand
Timo Reimann
2015/07/23 23:11:07
Renamed and replaced the set by Origin.
| |
| 70 base::Time remove_begin, | |
| 70 base::Time remove_end) override; | 71 base::Time remove_end) override; |
| 71 int RemoveDownloads(base::Time remove_begin) override; | 72 int RemoveDownloads(base::Time remove_begin) override; |
| 72 int RemoveAllDownloads() override; | 73 int RemoveAllDownloads() override; |
| 73 void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) override; | 74 void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) override; |
| 74 void AddObserver(Observer* observer) override; | 75 void AddObserver(Observer* observer) override; |
| 75 void RemoveObserver(Observer* observer) override; | 76 void RemoveObserver(Observer* observer) override; |
| 76 content::DownloadItem* CreateDownloadItem( | 77 content::DownloadItem* CreateDownloadItem( |
| 77 uint32 id, | 78 uint32 id, |
| 78 const base::FilePath& current_path, | 79 const base::FilePath& current_path, |
| 79 const base::FilePath& target_path, | 80 const base::FilePath& target_path, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 | 136 |
| 136 // Get next download id. |callback| is called on the UI thread and may | 137 // Get next download id. |callback| is called on the UI thread and may |
| 137 // be called synchronously. | 138 // be called synchronously. |
| 138 void GetNextId(const DownloadIdCallback& callback); | 139 void GetNextId(const DownloadIdCallback& callback); |
| 139 | 140 |
| 140 // Called with the result of DownloadManagerDelegate::CheckForFileExistence. | 141 // Called with the result of DownloadManagerDelegate::CheckForFileExistence. |
| 141 // Updates the state of the file and then notifies this update to the file's | 142 // Updates the state of the file and then notifies this update to the file's |
| 142 // observer. | 143 // observer. |
| 143 void OnFileExistenceChecked(uint32 download_id, bool result); | 144 void OnFileExistenceChecked(uint32 download_id, bool result); |
| 144 | 145 |
| 146 // Determines if the given URL is among the set of restricted URLs. This is | |
| 147 // required for origin-specific removal of downloads. | |
| 148 bool IsRestrictedUrl(const GURL& url, | |
|
Mike West
2015/07/22 20:16:03
1. You can move this to an static function in an a
Timo Reimann
2015/07/22 23:22:15
Done.
Timo Reimann
2015/07/23 23:11:07
Renamed and reimplemented the method. I use the un
Mike West
2015/07/24 06:56:39
This worries me a bit; we eventually want to build
| |
| 149 const std::set<GURL>& restricted_urls); | |
| 150 | |
| 145 // Overridden from DownloadItemImplDelegate | 151 // Overridden from DownloadItemImplDelegate |
| 146 // (Note that |GetBrowserContext| are present in both interfaces.) | 152 // (Note that |GetBrowserContext| are present in both interfaces.) |
| 147 void DetermineDownloadTarget(DownloadItemImpl* item, | 153 void DetermineDownloadTarget(DownloadItemImpl* item, |
| 148 const DownloadTargetCallback& callback) override; | 154 const DownloadTargetCallback& callback) override; |
| 149 bool ShouldCompleteDownload(DownloadItemImpl* item, | 155 bool ShouldCompleteDownload(DownloadItemImpl* item, |
| 150 const base::Closure& complete_callback) override; | 156 const base::Closure& complete_callback) override; |
| 151 bool ShouldOpenFileBasedOnExtension(const base::FilePath& path) override; | 157 bool ShouldOpenFileBasedOnExtension(const base::FilePath& path) override; |
| 152 bool ShouldOpenDownload(DownloadItemImpl* item, | 158 bool ShouldOpenDownload(DownloadItemImpl* item, |
| 153 const ShouldOpenDownloadCallback& callback) override; | 159 const ShouldOpenDownloadCallback& callback) override; |
| 154 void CheckForFileRemoval(DownloadItemImpl* download_item) override; | 160 void CheckForFileRemoval(DownloadItemImpl* download_item) override; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 net::NetLog* net_log_; | 194 net::NetLog* net_log_; |
| 189 | 195 |
| 190 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; | 196 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; |
| 191 | 197 |
| 192 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 198 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
| 193 }; | 199 }; |
| 194 | 200 |
| 195 } // namespace content | 201 } // namespace content |
| 196 | 202 |
| 197 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 203 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| OLD | NEW |