| 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_ITEM_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 virtual const std::string& GetETag() const OVERRIDE; | 122 virtual const std::string& GetETag() const OVERRIDE; |
| 123 virtual bool IsSavePackageDownload() const OVERRIDE; | 123 virtual bool IsSavePackageDownload() const OVERRIDE; |
| 124 virtual const base::FilePath& GetFullPath() const OVERRIDE; | 124 virtual const base::FilePath& GetFullPath() const OVERRIDE; |
| 125 virtual const base::FilePath& GetTargetFilePath() const OVERRIDE; | 125 virtual const base::FilePath& GetTargetFilePath() const OVERRIDE; |
| 126 virtual const base::FilePath& GetForcedFilePath() const OVERRIDE; | 126 virtual const base::FilePath& GetForcedFilePath() const OVERRIDE; |
| 127 virtual base::FilePath GetFileNameToReportUser() const OVERRIDE; | 127 virtual base::FilePath GetFileNameToReportUser() const OVERRIDE; |
| 128 virtual TargetDisposition GetTargetDisposition() const OVERRIDE; | 128 virtual TargetDisposition GetTargetDisposition() const OVERRIDE; |
| 129 virtual const std::string& GetHash() const OVERRIDE; | 129 virtual const std::string& GetHash() const OVERRIDE; |
| 130 virtual const std::string& GetHashState() const OVERRIDE; | 130 virtual const std::string& GetHashState() const OVERRIDE; |
| 131 virtual bool GetFileExternallyRemoved() const OVERRIDE; | 131 virtual bool GetFileExternallyRemoved() const OVERRIDE; |
| 132 virtual void DeleteFile() OVERRIDE; | 132 virtual void DeleteFile(const base::Callback<void(bool)>& callback) OVERRIDE; |
| 133 virtual bool IsDangerous() const OVERRIDE; | 133 virtual bool IsDangerous() const OVERRIDE; |
| 134 virtual DownloadDangerType GetDangerType() const OVERRIDE; | 134 virtual DownloadDangerType GetDangerType() const OVERRIDE; |
| 135 virtual bool TimeRemaining(base::TimeDelta* remaining) const OVERRIDE; | 135 virtual bool TimeRemaining(base::TimeDelta* remaining) const OVERRIDE; |
| 136 virtual int64 CurrentSpeed() const OVERRIDE; | 136 virtual int64 CurrentSpeed() const OVERRIDE; |
| 137 virtual int PercentComplete() const OVERRIDE; | 137 virtual int PercentComplete() const OVERRIDE; |
| 138 virtual bool AllDataSaved() const OVERRIDE; | 138 virtual bool AllDataSaved() const OVERRIDE; |
| 139 virtual int64 GetTotalBytes() const OVERRIDE; | 139 virtual int64 GetTotalBytes() const OVERRIDE; |
| 140 virtual int64 GetReceivedBytes() const OVERRIDE; | 140 virtual int64 GetReceivedBytes() const OVERRIDE; |
| 141 virtual base::Time GetStartTime() const OVERRIDE; | 141 virtual base::Time GetStartTime() const OVERRIDE; |
| 142 virtual base::Time GetEndTime() const OVERRIDE; | 142 virtual base::Time GetEndTime() const OVERRIDE; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 scoped_ptr<DownloadRequestHandleInterface> req_handle); | 177 scoped_ptr<DownloadRequestHandleInterface> req_handle); |
| 178 | 178 |
| 179 // Needed because of intertwining with DownloadManagerImpl ------------------- | 179 // Needed because of intertwining with DownloadManagerImpl ------------------- |
| 180 | 180 |
| 181 // TODO(rdsmith): Unwind DownloadManagerImpl and DownloadItemImpl, | 181 // TODO(rdsmith): Unwind DownloadManagerImpl and DownloadItemImpl, |
| 182 // removing these from the public interface. | 182 // removing these from the public interface. |
| 183 | 183 |
| 184 // Notify observers that this item is being removed by the user. | 184 // Notify observers that this item is being removed by the user. |
| 185 virtual void NotifyRemoved(); | 185 virtual void NotifyRemoved(); |
| 186 | 186 |
| 187 virtual void OnDownloadedFileRemoved(bool success); | 187 virtual void OnDownloadedFileRemoved(); |
| 188 | 188 |
| 189 // Provide a weak pointer reference to a DownloadDestinationObserver | 189 // Provide a weak pointer reference to a DownloadDestinationObserver |
| 190 // for use by download destinations. | 190 // for use by download destinations. |
| 191 virtual base::WeakPtr<DownloadDestinationObserver> | 191 virtual base::WeakPtr<DownloadDestinationObserver> |
| 192 DestinationObserverAsWeakPtr(); | 192 DestinationObserverAsWeakPtr(); |
| 193 | 193 |
| 194 // Get the download's BoundNetLog. | 194 // Get the download's BoundNetLog. |
| 195 virtual const net::BoundNetLog& GetBoundNetLog() const; | 195 virtual const net::BoundNetLog& GetBoundNetLog() const; |
| 196 | 196 |
| 197 // DownloadItemImpl routines only needed by SavePackage ---------------------- | 197 // DownloadItemImpl routines only needed by SavePackage ---------------------- |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 // Set the |danger_type_| and invoke obserers if necessary. | 367 // Set the |danger_type_| and invoke obserers if necessary. |
| 368 void SetDangerType(DownloadDangerType danger_type); | 368 void SetDangerType(DownloadDangerType danger_type); |
| 369 | 369 |
| 370 void SetFullPath(const base::FilePath& new_path); | 370 void SetFullPath(const base::FilePath& new_path); |
| 371 | 371 |
| 372 void AutoResumeIfValid(); | 372 void AutoResumeIfValid(); |
| 373 | 373 |
| 374 void ResumeInterruptedDownload(); | 374 void ResumeInterruptedDownload(); |
| 375 | 375 |
| 376 void DeleteFileDone(const base::Callback<void(bool)>& callback, bool success); |
| 377 |
| 376 static DownloadState InternalToExternalState( | 378 static DownloadState InternalToExternalState( |
| 377 DownloadInternalState internal_state); | 379 DownloadInternalState internal_state); |
| 378 static DownloadInternalState ExternalToInternalState( | 380 static DownloadInternalState ExternalToInternalState( |
| 379 DownloadState external_state); | 381 DownloadState external_state); |
| 380 | 382 |
| 381 // Debugging routines -------------------------------------------------------- | 383 // Debugging routines -------------------------------------------------------- |
| 382 static const char* DebugDownloadStateString(DownloadInternalState state); | 384 static const char* DebugDownloadStateString(DownloadInternalState state); |
| 383 static const char* DebugResumeModeString(ResumeMode mode); | 385 static const char* DebugResumeModeString(ResumeMode mode); |
| 384 | 386 |
| 385 // Will be false for save package downloads retrieved from the history. | 387 // Will be false for save package downloads retrieved from the history. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 const net::BoundNetLog bound_net_log_; | 544 const net::BoundNetLog bound_net_log_; |
| 543 | 545 |
| 544 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 546 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
| 545 | 547 |
| 546 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 548 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
| 547 }; | 549 }; |
| 548 | 550 |
| 549 } // namespace content | 551 } // namespace content |
| 550 | 552 |
| 551 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 553 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| OLD | NEW |