| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // DownloadItem::Completed(). | 266 // DownloadItem::Completed(). |
| 267 virtual void OnDownloadCompleting(); | 267 virtual void OnDownloadCompleting(); |
| 268 | 268 |
| 269 // Called after the delegate has given the go-ahead to actually complete | 269 // Called after the delegate has given the go-ahead to actually complete |
| 270 // the download. | 270 // the download. |
| 271 void ReadyForDownloadCompletionDone(); | 271 void ReadyForDownloadCompletionDone(); |
| 272 | 272 |
| 273 void OnDownloadRenamedToFinalName(DownloadInterruptReason reason, | 273 void OnDownloadRenamedToFinalName(DownloadInterruptReason reason, |
| 274 const FilePath& full_path); | 274 const FilePath& full_path); |
| 275 | 275 |
| 276 void ReleaseDownloadFile(); | |
| 277 | |
| 278 // TODO(rdsmith,asanka): Move the AnnotateWithSourceInformation() call to the | |
| 279 // final rename and eliminate the interrupt reason callback. | |
| 280 void OnDownloadFileReleased(DownloadInterruptReason reason); | |
| 281 | |
| 282 // Called if the embedder took over opening a download, to indicate that | 276 // Called if the embedder took over opening a download, to indicate that |
| 283 // the download has been opened. | 277 // the download has been opened. |
| 284 virtual void DelayedDownloadOpened(bool auto_opened); | 278 virtual void DelayedDownloadOpened(bool auto_opened); |
| 285 | 279 |
| 286 // Called when the entire download operation (including renaming etc) | 280 // Called when the entire download operation (including renaming etc) |
| 287 // is completed. | 281 // is completed. |
| 288 void Completed(); | 282 void Completed(); |
| 289 | 283 |
| 290 // Helper routines ----------------------------------------------------------- | 284 // Helper routines ----------------------------------------------------------- |
| 291 | 285 |
| 292 // Indicate that an error has occurred on the download. | 286 // Indicate that an error has occurred on the download. |
| 293 virtual void Interrupt(DownloadInterruptReason reason); | 287 virtual void Interrupt(DownloadInterruptReason reason); |
| 294 | 288 |
| 295 // Cancel the DownloadFile if we have it. | 289 // Cancel the DownloadFile if we have it. |
| 296 void CancelDownloadFile(); | 290 void CancelDownloadFile(); |
| 297 | 291 |
| 298 // Check if a download is ready for completion. | 292 // Check if a download is ready for completion. |
| 299 bool IsDownloadReadyForCompletion(); | 293 bool IsDownloadReadyForCompletion(); |
| 300 | 294 |
| 301 // Returns true if the download still needs to be renamed to | |
| 302 // GetTargetFilePath(). | |
| 303 bool NeedsRename() const; | |
| 304 | |
| 305 // Call to transition state; all state transitions should go through this. | 295 // Call to transition state; all state transitions should go through this. |
| 306 void TransitionTo(DownloadInternalState new_state); | 296 void TransitionTo(DownloadInternalState new_state); |
| 307 | 297 |
| 308 // Set the |danger_type_| and invoke obserers if necessary. | 298 // Set the |danger_type_| and invoke obserers if necessary. |
| 309 void SetDangerType(DownloadDangerType danger_type); | 299 void SetDangerType(DownloadDangerType danger_type); |
| 310 | 300 |
| 311 void SetFullPath(const FilePath& new_path); | 301 void SetFullPath(const FilePath& new_path); |
| 312 | 302 |
| 313 // Mapping between internal and external states. | 303 // Mapping between internal and external states. |
| 314 static DownloadState InternalToExternalState( | 304 static DownloadState InternalToExternalState( |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 const net::BoundNetLog bound_net_log_; | 474 const net::BoundNetLog bound_net_log_; |
| 485 | 475 |
| 486 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 476 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
| 487 | 477 |
| 488 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 478 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
| 489 }; | 479 }; |
| 490 | 480 |
| 491 } // namespace content | 481 } // namespace content |
| 492 | 482 |
| 493 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 483 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| OLD | NEW |