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
3 // found in the LICENSE file.
5 // The DownloadItemFactory is used to produce different DownloadItems.
6 // It is separate from the DownloadManager to allow download manager
7 // unit tests to control the items produced.
9 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_
10 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_
15 #include "base/memory/scoped_ptr.h"
16 #include "content/public/browser/download_item.h"
31 class DownloadItemImpl
;
32 class DownloadItemImplDelegate
;
33 class DownloadRequestHandleInterface
;
34 struct DownloadCreateInfo
;
36 class DownloadItemFactory
{
38 virtual ~DownloadItemFactory() {}
40 virtual DownloadItemImpl
* CreatePersistedItem(
41 DownloadItemImplDelegate
* delegate
,
43 const base::FilePath
& current_path
,
44 const base::FilePath
& target_path
,
45 const std::vector
<GURL
>& url_chain
,
46 const GURL
& referrer_url
,
47 const base::Time
& start_time
,
48 const base::Time
& end_time
,
49 const std::string
& etag
,
50 const std::string
& last_modified
,
53 DownloadItem::DownloadState state
,
54 DownloadDangerType danger_type
,
55 DownloadInterruptReason interrupt_reason
,
57 const net::BoundNetLog
& bound_net_log
) = 0;
59 virtual DownloadItemImpl
* CreateActiveItem(
60 DownloadItemImplDelegate
* delegate
,
62 const DownloadCreateInfo
& info
,
63 const net::BoundNetLog
& bound_net_log
) = 0;
65 virtual DownloadItemImpl
* CreateSavePageItem(
66 DownloadItemImplDelegate
* delegate
,
68 const base::FilePath
& path
,
70 const std::string
& mime_type
,
71 scoped_ptr
<DownloadRequestHandleInterface
> request_handle
,
72 const net::BoundNetLog
& bound_net_log
) = 0;
75 } // namespace content
77 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_