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 |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/sequenced_task_runner_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "content/browser/download/download_item_impl_delegate.h" | 18 #include "content/browser/download/download_item_impl_delegate.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/public/browser/download_manager.h" | 20 #include "content/public/browser/download_manager.h" |
| 21 #include "content/public/browser/download_url_parameters.h" |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 class BoundNetLog; | 24 class BoundNetLog; |
24 } | 25 } |
25 | 26 |
26 namespace content { | 27 namespace content { |
27 class DownloadFileFactory; | 28 class DownloadFileFactory; |
28 class DownloadItemFactory; | 29 class DownloadItemFactory; |
29 class DownloadItemImpl; | 30 class DownloadItemImpl; |
30 | 31 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 // For testing. | 94 // For testing. |
94 friend class DownloadManagerTest; | 95 friend class DownloadManagerTest; |
95 friend class DownloadTest; | 96 friend class DownloadTest; |
96 | 97 |
97 friend class base::RefCountedThreadSafe<DownloadManagerImpl>; | 98 friend class base::RefCountedThreadSafe<DownloadManagerImpl>; |
98 | 99 |
99 virtual ~DownloadManagerImpl(); | 100 virtual ~DownloadManagerImpl(); |
100 | 101 |
101 // Creates the download item. Must be called on the UI thread. | 102 // Creates the download item. Must be called on the UI thread. |
102 virtual DownloadItemImpl* CreateDownloadItem( | 103 virtual DownloadItemImpl* CreateDownloadItem(DownloadCreateInfo* info); |
103 DownloadCreateInfo* info, const net::BoundNetLog& bound_net_log); | |
104 | 104 |
105 // Get next download id. | 105 // Get next download id. |
106 DownloadId GetNextId(); | 106 DownloadId GetNextId(); |
107 | 107 |
108 // Called on the FILE thread to check the existence of a downloaded file. | 108 // Called on the FILE thread to check the existence of a downloaded file. |
109 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); | 109 void CheckForFileRemovalOnFileThread(int32 download_id, const FilePath& path); |
110 | 110 |
111 // Called on the UI thread if the FILE thread detects the removal of | 111 // 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 | 112 // the downloaded file. The UI thread updates the state of the file |
113 // and then notifies this update to the file's observer. | 113 // and then notifies this update to the file's observer. |
(...skipping 15 matching lines...) Expand all Loading... |
129 // (Note that |GetBrowserContext| are present in both interfaces.) | 129 // (Note that |GetBrowserContext| are present in both interfaces.) |
130 virtual void DetermineDownloadTarget( | 130 virtual void DetermineDownloadTarget( |
131 DownloadItemImpl* item, const DownloadTargetCallback& callback) OVERRIDE; | 131 DownloadItemImpl* item, const DownloadTargetCallback& callback) OVERRIDE; |
132 virtual void ReadyForDownloadCompletion( | 132 virtual void ReadyForDownloadCompletion( |
133 DownloadItemImpl* item, const base::Closure& complete_callback) OVERRIDE; | 133 DownloadItemImpl* item, const base::Closure& complete_callback) OVERRIDE; |
134 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; | 134 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; |
135 virtual bool ShouldOpenDownload( | 135 virtual bool ShouldOpenDownload( |
136 DownloadItemImpl* item, | 136 DownloadItemImpl* item, |
137 const ShouldOpenDownloadCallback& callback) OVERRIDE; | 137 const ShouldOpenDownloadCallback& callback) OVERRIDE; |
138 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; | 138 virtual void CheckForFileRemoval(DownloadItemImpl* download_item) OVERRIDE; |
| 139 virtual void ResumeInterruptedDownload( |
| 140 scoped_ptr<content::DownloadUrlParameters> params, |
| 141 content::DownloadId id) OVERRIDE; |
139 virtual void DownloadStopped(DownloadItemImpl* download) OVERRIDE; | 142 virtual void DownloadStopped(DownloadItemImpl* download) OVERRIDE; |
140 virtual void DownloadCompleted(DownloadItemImpl* download) OVERRIDE; | 143 virtual void DownloadCompleted(DownloadItemImpl* download) OVERRIDE; |
141 virtual void DownloadOpened(DownloadItemImpl* download) OVERRIDE; | 144 virtual void DownloadOpened(DownloadItemImpl* download) OVERRIDE; |
142 virtual void DownloadRemoved(DownloadItemImpl* download) OVERRIDE; | 145 virtual void DownloadRemoved(DownloadItemImpl* download) OVERRIDE; |
143 virtual void ShowDownloadInBrowser(DownloadItemImpl* download) OVERRIDE; | 146 virtual void ShowDownloadInBrowser(DownloadItemImpl* download) OVERRIDE; |
144 virtual void AssertStateConsistent(DownloadItemImpl* download) const OVERRIDE; | 147 virtual void AssertStateConsistent(DownloadItemImpl* download) const OVERRIDE; |
145 | 148 |
146 // Factory for creation of downloads items. | 149 // Factory for creation of downloads items. |
147 scoped_ptr<DownloadItemFactory> item_factory_; | 150 scoped_ptr<DownloadItemFactory> item_factory_; |
148 | 151 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 DownloadManagerDelegate* delegate_; | 191 DownloadManagerDelegate* delegate_; |
189 | 192 |
190 net::NetLog* net_log_; | 193 net::NetLog* net_log_; |
191 | 194 |
192 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 195 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
193 }; | 196 }; |
194 | 197 |
195 } // namespace content | 198 } // namespace content |
196 | 199 |
197 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 200 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
OLD | NEW |