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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 // Set the |danger_type_| and invoke obserers if necessary. | 368 // Set the |danger_type_| and invoke obserers if necessary. |
369 void SetDangerType(DownloadDangerType danger_type); | 369 void SetDangerType(DownloadDangerType danger_type); |
370 | 370 |
371 void SetFullPath(const base::FilePath& new_path); | 371 void SetFullPath(const base::FilePath& new_path); |
372 | 372 |
373 void AutoResumeIfValid(); | 373 void AutoResumeIfValid(); |
374 | 374 |
375 void ResumeInterruptedDownload(); | 375 void ResumeInterruptedDownload(); |
376 | 376 |
| 377 void DeleteFileDone(const base::Callback<void(bool)>& callback, bool success); |
| 378 |
377 static DownloadState InternalToExternalState( | 379 static DownloadState InternalToExternalState( |
378 DownloadInternalState internal_state); | 380 DownloadInternalState internal_state); |
379 static DownloadInternalState ExternalToInternalState( | 381 static DownloadInternalState ExternalToInternalState( |
380 DownloadState external_state); | 382 DownloadState external_state); |
381 | 383 |
382 // Debugging routines -------------------------------------------------------- | 384 // Debugging routines -------------------------------------------------------- |
383 static const char* DebugDownloadStateString(DownloadInternalState state); | 385 static const char* DebugDownloadStateString(DownloadInternalState state); |
384 static const char* DebugResumeModeString(ResumeMode mode); | 386 static const char* DebugResumeModeString(ResumeMode mode); |
385 | 387 |
386 // Will be false for save package downloads retrieved from the history. | 388 // Will be false for save package downloads retrieved from the history. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 const net::BoundNetLog bound_net_log_; | 545 const net::BoundNetLog bound_net_log_; |
544 | 546 |
545 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 547 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
546 | 548 |
547 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 549 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
548 }; | 550 }; |
549 | 551 |
550 } // namespace content | 552 } // namespace content |
551 | 553 |
552 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 554 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |