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 DownloadItemFactory is used to produce different DownloadItems. | 5 // The DownloadItemFactory is used to produce different DownloadItems. |
6 // It is separate from the DownloadManager to allow download manager | 6 // It is separate from the DownloadManager to allow download manager |
7 // unit tests to control the items produced. | 7 // unit tests to control the items produced. |
8 | 8 |
9 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ | 9 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ |
10 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ | 10 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "content/public/browser/download_id.h" | 15 #include "content/public/browser/download_id.h" |
16 #include "content/public/browser/download_item.h" | |
16 | 17 |
17 struct DownloadCreateInfo; | 18 struct DownloadCreateInfo; |
18 | 19 |
19 class DownloadItemImpl; | 20 class DownloadItemImpl; |
20 class DownloadItemImplDelegate; | 21 class DownloadItemImplDelegate; |
21 class DownloadRequestHandleInterface; | 22 class DownloadRequestHandleInterface; |
22 class FilePath; | 23 class FilePath; |
23 class GURL; | 24 class GURL; |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 class DownloadItem; | 27 class DownloadItem; |
27 struct DownloadPersistentStoreInfo; | |
28 } | 28 } |
29 | 29 |
30 namespace net { | 30 namespace net { |
31 class BoundNetLog; | 31 class BoundNetLog; |
32 } | 32 } |
33 | 33 |
34 namespace content { | 34 namespace content { |
35 | 35 |
36 class DownloadItemFactory { | 36 class DownloadItemFactory { |
37 public: | 37 public: |
38 virtual ~DownloadItemFactory() {} | 38 virtual ~DownloadItemFactory() {} |
39 | 39 |
40 virtual DownloadItemImpl* CreatePersistedItem( | 40 virtual DownloadItemImpl* CreatePersistedItem( |
Randy Smith (Not in Mondays)
2012/08/28 13:11:49
We need a better name for this. Completed item?
benjhayden
2012/09/10 19:02:56
There can also be IN_PROGRESS entries in the histo
Randy Smith (Not in Mondays)
2012/09/11 16:30:34
They still end up being finished when they're put
| |
41 DownloadItemImplDelegate* delegate, | 41 DownloadItemImplDelegate* delegate, |
42 content::DownloadId download_id, | 42 content::DownloadId download_id, |
43 const content::DownloadPersistentStoreInfo& info, | 43 const FilePath& path, |
44 const GURL& url, | |
45 const GURL& referrer_url, | |
46 const base::Time& start_time, | |
47 const base::Time& end_time, | |
48 int64 received_bytes, | |
49 int64 total_bytes, | |
50 content::DownloadItem::DownloadState state, | |
51 bool opened, | |
44 const net::BoundNetLog& bound_net_log) = 0; | 52 const net::BoundNetLog& bound_net_log) = 0; |
45 | 53 |
46 virtual DownloadItemImpl* CreateActiveItem( | 54 virtual DownloadItemImpl* CreateActiveItem( |
47 DownloadItemImplDelegate* delegate, | 55 DownloadItemImplDelegate* delegate, |
48 const DownloadCreateInfo& info, | 56 const DownloadCreateInfo& info, |
49 scoped_ptr<DownloadRequestHandleInterface> request_handle, | 57 scoped_ptr<DownloadRequestHandleInterface> request_handle, |
50 const net::BoundNetLog& bound_net_log) = 0; | 58 const net::BoundNetLog& bound_net_log) = 0; |
51 | 59 |
52 virtual DownloadItemImpl* CreateSavePageItem( | 60 virtual DownloadItemImpl* CreateSavePageItem( |
53 DownloadItemImplDelegate* delegate, | 61 DownloadItemImplDelegate* delegate, |
54 const FilePath& path, | 62 const FilePath& path, |
55 const GURL& url, | 63 const GURL& url, |
56 content::DownloadId download_id, | 64 content::DownloadId download_id, |
57 const std::string& mime_type, | 65 const std::string& mime_type, |
58 const net::BoundNetLog& bound_net_log) = 0; | 66 const net::BoundNetLog& bound_net_log) = 0; |
59 }; | 67 }; |
60 | 68 |
61 } // namespace content | 69 } // namespace content |
62 | 70 |
63 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ | 71 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ |
OLD | NEW |