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