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 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
8 // active browser context in Chrome. | 8 // active browser context in Chrome. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "base/basictypes.h" | 34 #include "base/basictypes.h" |
35 #include "base/file_path.h" | 35 #include "base/file_path.h" |
36 #include "base/gtest_prod_util.h" | 36 #include "base/gtest_prod_util.h" |
37 #include "base/message_loop_helpers.h" | 37 #include "base/message_loop_helpers.h" |
38 #include "base/time.h" | 38 #include "base/time.h" |
39 #include "content/browser/download/interrupt_reasons.h" | 39 #include "content/browser/download/interrupt_reasons.h" |
40 #include "content/public/browser/download_id.h" | 40 #include "content/public/browser/download_id.h" |
41 #include "content/public/browser/download_item.h" | 41 #include "content/public/browser/download_item.h" |
42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
| 43 #include "net/base/net_log.h" |
43 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
44 | 45 |
45 class DownloadFileManager; | 46 class DownloadFileManager; |
46 class DownloadManagerTest; | 47 class DownloadManagerTest; |
47 class DownloadRequestHandle; | 48 class DownloadRequestHandle; |
48 class GURL; | 49 class GURL; |
49 class TabContents; | 50 class TabContents; |
50 struct DownloadCreateInfo; | 51 struct DownloadCreateInfo; |
51 struct DownloadRetrieveInfo; | 52 struct DownloadRetrieveInfo; |
52 struct DownloadSaveInfo; | 53 struct DownloadSaveInfo; |
53 | 54 |
54 namespace content { | 55 namespace content { |
55 class BrowserContext; | 56 class BrowserContext; |
56 class DownloadManagerDelegate; | 57 class DownloadManagerDelegate; |
57 class DownloadQuery; | 58 class DownloadQuery; |
58 class WebContents; | 59 class WebContents; |
59 | 60 |
60 // Browser's download manager: manages all downloads and destination view. | 61 // Browser's download manager: manages all downloads and destination view. |
61 class CONTENT_EXPORT DownloadManager | 62 class CONTENT_EXPORT DownloadManager |
62 : public base::RefCountedThreadSafe<DownloadManager> { | 63 : public base::RefCountedThreadSafe<DownloadManager> { |
63 public: | 64 public: |
64 virtual ~DownloadManager() {} | 65 virtual ~DownloadManager() {} |
65 | 66 |
66 static DownloadManager* Create( | 67 static DownloadManager* Create( |
67 DownloadManagerDelegate* delegate); | 68 DownloadManagerDelegate* delegate, |
| 69 net::NetLog* net_log); |
68 | 70 |
69 // Shutdown the download manager. Must be called before destruction. | 71 // Shutdown the download manager. Must be called before destruction. |
70 virtual void Shutdown() = 0; | 72 virtual void Shutdown() = 0; |
71 | 73 |
72 // Interface to implement for observers that wish to be informed of changes | 74 // Interface to implement for observers that wish to be informed of changes |
73 // to the DownloadManager's collection of downloads. | 75 // to the DownloadManager's collection of downloads. |
74 class CONTENT_EXPORT Observer { | 76 class CONTENT_EXPORT Observer { |
75 public: | 77 public: |
76 // New or deleted download, observers should query us for the current set | 78 // New or deleted download, observers should query us for the current set |
77 // of downloads. | 79 // of downloads. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 int64 db_handle) = 0; | 201 int64 db_handle) = 0; |
200 | 202 |
201 // The number of in progress (including paused) downloads. | 203 // The number of in progress (including paused) downloads. |
202 virtual int InProgressCount() const = 0; | 204 virtual int InProgressCount() const = 0; |
203 | 205 |
204 virtual content::BrowserContext* GetBrowserContext() const = 0; | 206 virtual content::BrowserContext* GetBrowserContext() const = 0; |
205 | 207 |
206 virtual FilePath LastDownloadPath() = 0; | 208 virtual FilePath LastDownloadPath() = 0; |
207 | 209 |
208 // Creates the download item. Must be called on the UI thread. | 210 // Creates the download item. Must be called on the UI thread. |
209 virtual void CreateDownloadItem( | 211 // Returns the |BoundNetLog| used by the |DownloadItem|. |
| 212 virtual net::BoundNetLog CreateDownloadItem( |
210 DownloadCreateInfo* info, | 213 DownloadCreateInfo* info, |
211 const DownloadRequestHandle& request_handle) = 0; | 214 const DownloadRequestHandle& request_handle) = 0; |
212 | 215 |
213 // Creates a download item for the SavePackage system. | 216 // Creates a download item for the SavePackage system. |
214 // Must be called on the UI thread. Note that the DownloadManager | 217 // Must be called on the UI thread. Note that the DownloadManager |
215 // retains ownership. | 218 // retains ownership. |
216 virtual DownloadItem* CreateSavePackageDownloadItem( | 219 virtual DownloadItem* CreateSavePackageDownloadItem( |
217 const FilePath& main_file_path, | 220 const FilePath& main_file_path, |
218 const GURL& page_url, | 221 const GURL& page_url, |
219 bool is_otr, | 222 bool is_otr, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 friend class base::RefCountedThreadSafe< | 280 friend class base::RefCountedThreadSafe< |
278 DownloadManager, content::BrowserThread::DeleteOnUIThread>; | 281 DownloadManager, content::BrowserThread::DeleteOnUIThread>; |
279 friend struct content::BrowserThread::DeleteOnThread< | 282 friend struct content::BrowserThread::DeleteOnThread< |
280 content::BrowserThread::UI>; | 283 content::BrowserThread::UI>; |
281 friend class base::DeleteHelper<DownloadManager>; | 284 friend class base::DeleteHelper<DownloadManager>; |
282 }; | 285 }; |
283 | 286 |
284 } // namespace content | 287 } // namespace content |
285 | 288 |
286 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 289 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
OLD | NEW |