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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 scoped_ptr<ByteStreamReader> stream) OVERRIDE; | 57 scoped_ptr<ByteStreamReader> stream) OVERRIDE; |
58 virtual void CancelDownload(int32 download_id) OVERRIDE; | 58 virtual void CancelDownload(int32 download_id) OVERRIDE; |
59 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 59 virtual int RemoveDownloadsBetween(base::Time remove_begin, |
60 base::Time remove_end) OVERRIDE; | 60 base::Time remove_end) OVERRIDE; |
61 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; | 61 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; |
62 virtual int RemoveAllDownloads() OVERRIDE; | 62 virtual int RemoveAllDownloads() OVERRIDE; |
63 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; | 63 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; |
64 virtual void AddObserver(Observer* observer) OVERRIDE; | 64 virtual void AddObserver(Observer* observer) OVERRIDE; |
65 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 65 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
66 virtual content::DownloadItem* CreateDownloadItem( | 66 virtual content::DownloadItem* CreateDownloadItem( |
67 const FilePath& path, | 67 const FilePath& current_path, |
68 const GURL& url, | 68 const FilePath& target_path, |
| 69 const std::vector<GURL>& url_chain, |
69 const GURL& referrer_url, | 70 const GURL& referrer_url, |
70 const base::Time& start_time, | 71 const base::Time& start_time, |
71 const base::Time& end_time, | 72 const base::Time& end_time, |
72 int64 received_bytes, | 73 int64 received_bytes, |
73 int64 total_bytes, | 74 int64 total_bytes, |
74 content::DownloadItem::DownloadState state, | 75 content::DownloadItem::DownloadState state, |
| 76 DownloadInterruptReason interrupt_reason, |
75 bool opened) OVERRIDE; | 77 bool opened) OVERRIDE; |
76 virtual int InProgressCount() const OVERRIDE; | 78 virtual int InProgressCount() const OVERRIDE; |
77 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 79 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
78 virtual void CheckForHistoryFilesRemoval() OVERRIDE; | 80 virtual void CheckForHistoryFilesRemoval() OVERRIDE; |
79 virtual DownloadItem* GetDownload(int id) OVERRIDE; | 81 virtual DownloadItem* GetDownload(int id) OVERRIDE; |
80 | 82 |
81 // For testing; specifically, accessed from TestFileErrorInjector. | 83 // For testing; specifically, accessed from TestFileErrorInjector. |
82 void SetDownloadItemFactoryForTesting( | 84 void SetDownloadItemFactoryForTesting( |
83 scoped_ptr<DownloadItemFactory> item_factory); | 85 scoped_ptr<DownloadItemFactory> item_factory); |
84 void SetDownloadFileFactoryForTesting( | 86 void SetDownloadFileFactoryForTesting( |
85 scoped_ptr<DownloadFileFactory> file_factory); | 87 scoped_ptr<DownloadFileFactory> file_factory); |
86 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); | 88 virtual DownloadFileFactory* GetDownloadFileFactoryForTesting(); |
87 | 89 |
88 private: | 90 private: |
89 typedef std::set<DownloadItem*> DownloadSet; | 91 typedef std::set<DownloadItem*> DownloadSet; |
90 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap; | 92 typedef base::hash_map<int32, DownloadItemImpl*> DownloadMap; |
91 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; | 93 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; |
92 | 94 |
93 // For testing. | 95 // For testing. |
94 friend class DownloadManagerTest; | 96 friend class DownloadManagerTest; |
95 friend class DownloadTest; | 97 friend class DownloadTest; |
96 | 98 |
97 friend class base::RefCountedThreadSafe<DownloadManagerImpl>; | 99 friend class base::RefCountedThreadSafe<DownloadManagerImpl>; |
98 | 100 |
99 virtual ~DownloadManagerImpl(); | 101 virtual ~DownloadManagerImpl(); |
100 | 102 |
101 // Creates the download item. Must be called on the UI thread. | 103 // Creates the download item based on a DownloadCreateInfo from the IO |
102 virtual DownloadItemImpl* CreateDownloadItem( | 104 // thread. Must be called on the UI thread. |
| 105 virtual DownloadItemImpl* CreateDownloadItemInternal( |
103 DownloadCreateInfo* info, const net::BoundNetLog& bound_net_log); | 106 DownloadCreateInfo* info, const net::BoundNetLog& bound_net_log); |
104 | 107 |
105 // Get next download id. | 108 // Get next download id. |
106 DownloadId GetNextId(); | 109 DownloadId GetNextId(); |
107 | 110 |
108 // Called on the FILE thread to check the existence of a downloaded file. | 111 // Called on the FILE thread to check the existence of a downloaded file. |
109 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); | 112 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); |
110 | 113 |
111 // Called on the UI thread if the FILE thread detects the removal of | 114 // Called on the UI thread if the FILE thread detects the removal of |
112 // the downloaded file. The UI thread updates the state of the file | 115 // the downloaded file. The UI thread updates the state of the file |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 DownloadManagerDelegate* delegate_; | 161 DownloadManagerDelegate* delegate_; |
159 | 162 |
160 net::NetLog* net_log_; | 163 net::NetLog* net_log_; |
161 | 164 |
162 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 165 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
163 }; | 166 }; |
164 | 167 |
165 } // namespace content | 168 } // namespace content |
166 | 169 |
167 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 170 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |