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 #include <vector> |
13 | 14 |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "content/public/browser/download_id.h" | 16 #include "content/public/browser/download_id.h" |
16 #include "content/public/browser/download_item.h" | 17 #include "content/public/browser/download_item.h" |
17 | 18 |
18 class FilePath; | 19 class FilePath; |
19 class GURL; | 20 class GURL; |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 class BoundNetLog; | 23 class BoundNetLog; |
23 } | 24 } |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 class DownloadItem; | 28 class DownloadItem; |
28 class DownloadItemImpl; | 29 class DownloadItemImpl; |
29 class DownloadItemImplDelegate; | 30 class DownloadItemImplDelegate; |
30 class DownloadRequestHandleInterface; | 31 class DownloadRequestHandleInterface; |
31 struct DownloadCreateInfo; | 32 struct DownloadCreateInfo; |
32 | 33 |
33 class DownloadItemFactory { | 34 class DownloadItemFactory { |
34 public: | 35 public: |
35 virtual ~DownloadItemFactory() {} | 36 virtual ~DownloadItemFactory() {} |
36 | 37 |
37 virtual DownloadItemImpl* CreatePersistedItem( | 38 virtual DownloadItemImpl* CreatePersistedItem( |
38 DownloadItemImplDelegate* delegate, | 39 DownloadItemImplDelegate* delegate, |
39 DownloadId download_id, | 40 DownloadId download_id, |
40 const FilePath& path, | 41 const FilePath& current_path, |
41 const GURL& url, | 42 const FilePath& target_path, |
| 43 const std::vector<GURL>& url_chain, |
42 const GURL& referrer_url, | 44 const GURL& referrer_url, |
43 const base::Time& start_time, | 45 const base::Time& start_time, |
44 const base::Time& end_time, | 46 const base::Time& end_time, |
45 int64 received_bytes, | 47 int64 received_bytes, |
46 int64 total_bytes, | 48 int64 total_bytes, |
47 content::DownloadItem::DownloadState state, | 49 DownloadItem::DownloadState state, |
| 50 DownloadDangerType danger_type, |
| 51 DownloadInterruptReason interrupt_reason, |
48 bool opened, | 52 bool opened, |
49 const net::BoundNetLog& bound_net_log) = 0; | 53 const net::BoundNetLog& bound_net_log) = 0; |
50 | 54 |
51 virtual DownloadItemImpl* CreateActiveItem( | 55 virtual DownloadItemImpl* CreateActiveItem( |
52 DownloadItemImplDelegate* delegate, | 56 DownloadItemImplDelegate* delegate, |
53 const DownloadCreateInfo& info, | 57 const DownloadCreateInfo& info, |
54 const net::BoundNetLog& bound_net_log) = 0; | 58 const net::BoundNetLog& bound_net_log) = 0; |
55 | 59 |
56 virtual DownloadItemImpl* CreateSavePageItem( | 60 virtual DownloadItemImpl* CreateSavePageItem( |
57 DownloadItemImplDelegate* delegate, | 61 DownloadItemImplDelegate* delegate, |
58 const FilePath& path, | 62 const FilePath& path, |
59 const GURL& url, | 63 const GURL& url, |
60 DownloadId download_id, | 64 DownloadId download_id, |
61 const std::string& mime_type, | 65 const std::string& mime_type, |
62 const net::BoundNetLog& bound_net_log) = 0; | 66 const net::BoundNetLog& bound_net_log) = 0; |
63 }; | 67 }; |
64 | 68 |
65 } // namespace content | 69 } // namespace content |
66 | 70 |
67 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ | 71 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ |
OLD | NEW |