| 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 class DownloadItem; | |
| 27 struct DownloadPersistentStoreInfo; | |
| 28 } | |
| 29 | |
| 30 namespace net { | 26 namespace net { |
| 31 class BoundNetLog; | 27 class BoundNetLog; |
| 32 } | 28 } |
| 33 | 29 |
| 34 namespace content { | 30 namespace content { |
| 35 | 31 |
| 36 class DownloadItemFactory { | 32 class DownloadItemFactory { |
| 37 public: | 33 public: |
| 38 virtual ~DownloadItemFactory() {} | 34 virtual ~DownloadItemFactory() {} |
| 39 | 35 |
| 40 virtual DownloadItemImpl* CreatePersistedItem( | 36 virtual DownloadItemImpl* CreatePersistedItem( |
| 41 DownloadItemImplDelegate* delegate, | 37 DownloadItemImplDelegate* delegate, |
| 42 content::DownloadId download_id, | 38 content::DownloadId download_id, |
| 43 const content::DownloadPersistentStoreInfo& info, | 39 const FilePath& path, |
| 40 const GURL& url, |
| 41 const GURL& referrer_url, |
| 42 const base::Time& start_time, |
| 43 const base::Time& end_time, |
| 44 int64 received_bytes, |
| 45 int64 total_bytes, |
| 46 content::DownloadItem::DownloadState state, |
| 47 bool opened, |
| 44 const net::BoundNetLog& bound_net_log) = 0; | 48 const net::BoundNetLog& bound_net_log) = 0; |
| 45 | 49 |
| 46 virtual DownloadItemImpl* CreateActiveItem( | 50 virtual DownloadItemImpl* CreateActiveItem( |
| 47 DownloadItemImplDelegate* delegate, | 51 DownloadItemImplDelegate* delegate, |
| 48 const DownloadCreateInfo& info, | 52 const DownloadCreateInfo& info, |
| 49 scoped_ptr<DownloadRequestHandleInterface> request_handle, | 53 scoped_ptr<DownloadRequestHandleInterface> request_handle, |
| 50 const net::BoundNetLog& bound_net_log) = 0; | 54 const net::BoundNetLog& bound_net_log) = 0; |
| 51 | 55 |
| 52 virtual DownloadItemImpl* CreateSavePageItem( | 56 virtual DownloadItemImpl* CreateSavePageItem( |
| 53 DownloadItemImplDelegate* delegate, | 57 DownloadItemImplDelegate* delegate, |
| 54 const FilePath& path, | 58 const FilePath& path, |
| 55 const GURL& url, | 59 const GURL& url, |
| 56 content::DownloadId download_id, | 60 content::DownloadId download_id, |
| 57 const std::string& mime_type, | 61 const std::string& mime_type, |
| 58 const net::BoundNetLog& bound_net_log) = 0; | 62 const net::BoundNetLog& bound_net_log) = 0; |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace content | 65 } // namespace content |
| 62 | 66 |
| 63 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ | 67 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_FACTORY_H_ |
| OLD | NEW |