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