| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 virtual void SetTotalBytes(int64_t total_bytes); | 215 virtual void SetTotalBytes(int64_t total_bytes); |
| 216 | 216 |
| 217 virtual void OnAllDataSaved(int64_t total_bytes, | 217 virtual void OnAllDataSaved(int64_t total_bytes, |
| 218 std::unique_ptr<crypto::SecureHash> hash_state); | 218 std::unique_ptr<crypto::SecureHash> hash_state); |
| 219 | 219 |
| 220 // Called by SavePackage to display progress when the DownloadItem | 220 // Called by SavePackage to display progress when the DownloadItem |
| 221 // should be considered complete. | 221 // should be considered complete. |
| 222 virtual void MarkAsComplete(); | 222 virtual void MarkAsComplete(); |
| 223 | 223 |
| 224 // DownloadDestinationObserver | 224 // DownloadDestinationObserver |
| 225 void DestinationUpdate(int64_t bytes_so_far, int64_t bytes_per_sec) override; | 225 void DestinationUpdate( |
| 226 int64_t bytes_so_far, |
| 227 int64_t bytes_per_sec, |
| 228 const std::vector<DownloadItem::ReceivedSlice>& received_slices) override; |
| 226 void DestinationError( | 229 void DestinationError( |
| 227 DownloadInterruptReason reason, | 230 DownloadInterruptReason reason, |
| 228 int64_t bytes_so_far, | 231 int64_t bytes_so_far, |
| 229 std::unique_ptr<crypto::SecureHash> hash_state) override; | 232 std::unique_ptr<crypto::SecureHash> hash_state) override; |
| 230 void DestinationCompleted( | 233 void DestinationCompleted( |
| 231 int64_t total_bytes, | 234 int64_t total_bytes, |
| 232 std::unique_ptr<crypto::SecureHash> hash_state) override; | 235 std::unique_ptr<crypto::SecureHash> hash_state) override; |
| 233 | 236 |
| 234 private: | 237 private: |
| 235 // Fine grained states of a download. | 238 // Fine grained states of a download. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 void InterruptAndDiscardPartialState(DownloadInterruptReason reason); | 448 void InterruptAndDiscardPartialState(DownloadInterruptReason reason); |
| 446 | 449 |
| 447 // Indiates that an error has occurred on the download. The |bytes_so_far| and | 450 // Indiates that an error has occurred on the download. The |bytes_so_far| and |
| 448 // |hash_state| should correspond to the state of the DownloadFile. If the | 451 // |hash_state| should correspond to the state of the DownloadFile. If the |
| 449 // interrupt reason allows, this partial state may be allowed to continue the | 452 // interrupt reason allows, this partial state may be allowed to continue the |
| 450 // interrupted download upon resumption. | 453 // interrupted download upon resumption. |
| 451 void InterruptWithPartialState(int64_t bytes_so_far, | 454 void InterruptWithPartialState(int64_t bytes_so_far, |
| 452 std::unique_ptr<crypto::SecureHash> hash_state, | 455 std::unique_ptr<crypto::SecureHash> hash_state, |
| 453 DownloadInterruptReason reason); | 456 DownloadInterruptReason reason); |
| 454 | 457 |
| 455 void UpdateProgress(int64_t bytes_so_far, int64_t bytes_per_sec); | 458 void UpdateProgress( |
| 459 int64_t bytes_so_far, |
| 460 int64_t bytes_per_sec, |
| 461 const std::vector<DownloadItem::ReceivedSlice>& received_slices); |
| 456 | 462 |
| 457 // Set |hash_| and |hash_state_| based on |hash_state|. | 463 // Set |hash_| and |hash_state_| based on |hash_state|. |
| 458 void SetHashState(std::unique_ptr<crypto::SecureHash> hash_state); | 464 void SetHashState(std::unique_ptr<crypto::SecureHash> hash_state); |
| 459 | 465 |
| 460 // Destroy the DownloadFile object. If |destroy_file| is true, the file is | 466 // Destroy the DownloadFile object. If |destroy_file| is true, the file is |
| 461 // destroyed with it. Otherwise, DownloadFile::Detach() is called before | 467 // destroyed with it. Otherwise, DownloadFile::Detach() is called before |
| 462 // object destruction to prevent file destruction. Destroying the file also | 468 // object destruction to prevent file destruction. Destroying the file also |
| 463 // resets |current_path_|. | 469 // resets |current_path_|. |
| 464 void ReleaseDownloadFile(bool destroy_file); | 470 void ReleaseDownloadFile(bool destroy_file); |
| 465 | 471 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 const net::NetLogWithSource net_log_; | 691 const net::NetLogWithSource net_log_; |
| 686 | 692 |
| 687 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 693 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
| 688 | 694 |
| 689 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 695 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
| 690 }; | 696 }; |
| 691 | 697 |
| 692 } // namespace content | 698 } // namespace content |
| 693 | 699 |
| 694 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 700 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| OLD | NEW |