| 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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/sequenced_task_runner_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
| 17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 18 #include "content/browser/download/download_item_impl_delegate.h" | 18 #include "content/browser/download/download_item_impl_delegate.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/public/browser/download_interrupt_reasons.h" |
| 20 #include "content/public/browser/download_manager.h" | 21 #include "content/public/browser/download_manager.h" |
| 21 #include "content/public/browser/download_manager_delegate.h" | 22 #include "content/public/browser/download_manager_delegate.h" |
| 22 #include "content/public/browser/download_url_parameters.h" | 23 #include "content/public/browser/download_url_parameters.h" |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 class BoundNetLog; | 26 class BoundNetLog; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace content { | 29 namespace content { |
| 29 class DownloadFileFactory; | 30 class DownloadFileFactory; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 56 // Notifies DownloadManager about a successful completion of |download_item|. | 57 // Notifies DownloadManager about a successful completion of |download_item|. |
| 57 void OnSavePackageSuccessfullyFinished(DownloadItem* download_item); | 58 void OnSavePackageSuccessfullyFinished(DownloadItem* download_item); |
| 58 | 59 |
| 59 // DownloadManager functions. | 60 // DownloadManager functions. |
| 60 virtual void SetDelegate(DownloadManagerDelegate* delegate) OVERRIDE; | 61 virtual void SetDelegate(DownloadManagerDelegate* delegate) OVERRIDE; |
| 61 virtual DownloadManagerDelegate* GetDelegate() const OVERRIDE; | 62 virtual DownloadManagerDelegate* GetDelegate() const OVERRIDE; |
| 62 virtual void Shutdown() OVERRIDE; | 63 virtual void Shutdown() OVERRIDE; |
| 63 virtual void GetAllDownloads(DownloadVector* result) OVERRIDE; | 64 virtual void GetAllDownloads(DownloadVector* result) OVERRIDE; |
| 64 virtual void StartDownload( | 65 virtual void StartDownload( |
| 65 scoped_ptr<DownloadCreateInfo> info, | 66 scoped_ptr<DownloadCreateInfo> info, |
| 66 scoped_ptr<ByteStreamReader> stream, | 67 scoped_ptr<ByteStreamReader<DownloadInterruptReason> > stream, |
| 67 const DownloadUrlParameters::OnStartedCallback& on_started) OVERRIDE; | 68 const DownloadUrlParameters::OnStartedCallback& on_started) OVERRIDE; |
| 68 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 69 virtual int RemoveDownloadsBetween(base::Time remove_begin, |
| 69 base::Time remove_end) OVERRIDE; | 70 base::Time remove_end) OVERRIDE; |
| 70 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; | 71 virtual int RemoveDownloads(base::Time remove_begin) OVERRIDE; |
| 71 virtual int RemoveAllDownloads() OVERRIDE; | 72 virtual int RemoveAllDownloads() OVERRIDE; |
| 72 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; | 73 virtual void DownloadUrl(scoped_ptr<DownloadUrlParameters> params) OVERRIDE; |
| 73 virtual void AddObserver(Observer* observer) OVERRIDE; | 74 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 74 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 75 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 75 virtual content::DownloadItem* CreateDownloadItem( | 76 virtual content::DownloadItem* CreateDownloadItem( |
| 76 uint32 id, | 77 uint32 id, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 102 typedef std::set<DownloadItem*> DownloadSet; | 103 typedef std::set<DownloadItem*> DownloadSet; |
| 103 typedef base::hash_map<uint32, DownloadItemImpl*> DownloadMap; | 104 typedef base::hash_map<uint32, DownloadItemImpl*> DownloadMap; |
| 104 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; | 105 typedef std::vector<DownloadItemImpl*> DownloadItemImplVector; |
| 105 | 106 |
| 106 // For testing. | 107 // For testing. |
| 107 friend class DownloadManagerTest; | 108 friend class DownloadManagerTest; |
| 108 friend class DownloadTest; | 109 friend class DownloadTest; |
| 109 | 110 |
| 110 void StartDownloadWithId( | 111 void StartDownloadWithId( |
| 111 scoped_ptr<DownloadCreateInfo> info, | 112 scoped_ptr<DownloadCreateInfo> info, |
| 112 scoped_ptr<ByteStreamReader> stream, | 113 scoped_ptr<ByteStreamReader<DownloadInterruptReason> > stream, |
| 113 const DownloadUrlParameters::OnStartedCallback& on_started, | 114 const DownloadUrlParameters::OnStartedCallback& on_started, |
| 114 bool new_download, | 115 bool new_download, |
| 115 uint32 id); | 116 uint32 id); |
| 116 | 117 |
| 117 void CreateSavePackageDownloadItemWithId( | 118 void CreateSavePackageDownloadItemWithId( |
| 118 const base::FilePath& main_file_path, | 119 const base::FilePath& main_file_path, |
| 119 const GURL& page_url, | 120 const GURL& page_url, |
| 120 const std::string& mime_type, | 121 const std::string& mime_type, |
| 121 scoped_ptr<DownloadRequestHandleInterface> request_handle, | 122 scoped_ptr<DownloadRequestHandleInterface> request_handle, |
| 122 const DownloadItemImplCreated& on_started, | 123 const DownloadItemImplCreated& on_started, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 net::NetLog* net_log_; | 185 net::NetLog* net_log_; |
| 185 | 186 |
| 186 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; | 187 base::WeakPtrFactory<DownloadManagerImpl> weak_factory_; |
| 187 | 188 |
| 188 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); | 189 DISALLOW_COPY_AND_ASSIGN(DownloadManagerImpl); |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 } // namespace content | 192 } // namespace content |
| 192 | 193 |
| 193 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ | 194 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_ |
| OLD | NEW |