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