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 |
55 namespace net { | |
56 class NetLog; | |
57 } // namespace net | |
Randy Smith (Not in Mondays)
2012/02/07 23:21:31
You don't need the terminal comment if it's this s
ahendrickson
2012/02/07 23:58:54
Removed.
| |
58 | |
54 namespace content { | 59 namespace content { |
55 class BrowserContext; | 60 class BrowserContext; |
56 class DownloadManagerDelegate; | 61 class DownloadManagerDelegate; |
57 class DownloadQuery; | 62 class DownloadQuery; |
58 class WebContents; | 63 class WebContents; |
59 | 64 |
60 // Browser's download manager: manages all downloads and destination view. | 65 // Browser's download manager: manages all downloads and destination view. |
61 class CONTENT_EXPORT DownloadManager | 66 class CONTENT_EXPORT DownloadManager |
62 : public base::RefCountedThreadSafe<DownloadManager> { | 67 : public base::RefCountedThreadSafe<DownloadManager> { |
63 public: | 68 public: |
64 virtual ~DownloadManager() {} | 69 virtual ~DownloadManager() {} |
65 | 70 |
66 static DownloadManager* Create( | 71 static DownloadManager* Create( |
67 DownloadManagerDelegate* delegate); | 72 DownloadManagerDelegate* delegate, |
73 net::NetLog* net_log); | |
68 | 74 |
69 // Shutdown the download manager. Must be called before destruction. | 75 // Shutdown the download manager. Must be called before destruction. |
70 virtual void Shutdown() = 0; | 76 virtual void Shutdown() = 0; |
71 | 77 |
72 // Interface to implement for observers that wish to be informed of changes | 78 // Interface to implement for observers that wish to be informed of changes |
73 // to the DownloadManager's collection of downloads. | 79 // to the DownloadManager's collection of downloads. |
74 class CONTENT_EXPORT Observer { | 80 class CONTENT_EXPORT Observer { |
75 public: | 81 public: |
76 // New or deleted download, observers should query us for the current set | 82 // New or deleted download, observers should query us for the current set |
77 // of downloads. | 83 // of downloads. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 int64 db_handle) = 0; | 205 int64 db_handle) = 0; |
200 | 206 |
201 // The number of in progress (including paused) downloads. | 207 // The number of in progress (including paused) downloads. |
202 virtual int InProgressCount() const = 0; | 208 virtual int InProgressCount() const = 0; |
203 | 209 |
204 virtual content::BrowserContext* GetBrowserContext() const = 0; | 210 virtual content::BrowserContext* GetBrowserContext() const = 0; |
205 | 211 |
206 virtual FilePath LastDownloadPath() = 0; | 212 virtual FilePath LastDownloadPath() = 0; |
207 | 213 |
208 // Creates the download item. Must be called on the UI thread. | 214 // Creates the download item. Must be called on the UI thread. |
209 virtual void CreateDownloadItem( | 215 virtual net::BoundNetLog CreateDownloadItem( |
Randy Smith (Not in Mondays)
2012/02/07 23:19:14
Could you document the return value?
ahendrickson
2012/02/07 23:58:54
Done.
| |
210 DownloadCreateInfo* info, | 216 DownloadCreateInfo* info, |
211 const DownloadRequestHandle& request_handle) = 0; | 217 const DownloadRequestHandle& request_handle) = 0; |
212 | 218 |
213 // Creates a download item for the SavePackage system. | 219 // Creates a download item for the SavePackage system. |
214 // Must be called on the UI thread. Note that the DownloadManager | 220 // Must be called on the UI thread. Note that the DownloadManager |
215 // retains ownership. | 221 // retains ownership. |
216 virtual DownloadItem* CreateSavePackageDownloadItem( | 222 virtual DownloadItem* CreateSavePackageDownloadItem( |
217 const FilePath& main_file_path, | 223 const FilePath& main_file_path, |
218 const GURL& page_url, | 224 const GURL& page_url, |
219 bool is_otr, | 225 bool is_otr, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 friend class base::RefCountedThreadSafe< | 283 friend class base::RefCountedThreadSafe< |
278 DownloadManager, content::BrowserThread::DeleteOnUIThread>; | 284 DownloadManager, content::BrowserThread::DeleteOnUIThread>; |
279 friend struct content::BrowserThread::DeleteOnThread< | 285 friend struct content::BrowserThread::DeleteOnThread< |
280 content::BrowserThread::UI>; | 286 content::BrowserThread::UI>; |
281 friend class base::DeleteHelper<DownloadManager>; | 287 friend class base::DeleteHelper<DownloadManager>; |
282 }; | 288 }; |
283 | 289 |
284 } // namespace content | 290 } // namespace content |
285 | 291 |
286 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 292 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
OLD | NEW |