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 <string> | 10 #include <string> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // The maximum number of attempts we will make to resume automatically. | 45 // The maximum number of attempts we will make to resume automatically. |
46 static const int kMaxAutoResumeAttempts; | 46 static const int kMaxAutoResumeAttempts; |
47 | 47 |
48 // Note that it is the responsibility of the caller to ensure that a | 48 // Note that it is the responsibility of the caller to ensure that a |
49 // DownloadItemImplDelegate passed to a DownloadItemImpl constructor | 49 // DownloadItemImplDelegate passed to a DownloadItemImpl constructor |
50 // outlives the DownloadItemImpl. | 50 // outlives the DownloadItemImpl. |
51 | 51 |
52 // Constructing from persistent store: | 52 // Constructing from persistent store: |
53 // |bound_net_log| is constructed externally for our use. | 53 // |bound_net_log| is constructed externally for our use. |
54 DownloadItemImpl(DownloadItemImplDelegate* delegate, | 54 DownloadItemImpl(DownloadItemImplDelegate* delegate, |
| 55 const std::string& guid, |
55 uint32_t id, | 56 uint32_t id, |
56 const base::FilePath& current_path, | 57 const base::FilePath& current_path, |
57 const base::FilePath& target_path, | 58 const base::FilePath& target_path, |
58 const std::vector<GURL>& url_chain, | 59 const std::vector<GURL>& url_chain, |
59 const GURL& referrer_url, | 60 const GURL& referrer_url, |
60 const std::string& mime_type, | 61 const std::string& mime_type, |
61 const std::string& original_mime_type, | 62 const std::string& original_mime_type, |
62 const base::Time& start_time, | 63 const base::Time& start_time, |
63 const base::Time& end_time, | 64 const base::Time& end_time, |
64 const std::string& etag, | 65 const std::string& etag, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void UpdateObservers() override; | 99 void UpdateObservers() override; |
99 void ValidateDangerousDownload() override; | 100 void ValidateDangerousDownload() override; |
100 void StealDangerousDownload(const AcquireFileCallback& callback) override; | 101 void StealDangerousDownload(const AcquireFileCallback& callback) override; |
101 void Pause() override; | 102 void Pause() override; |
102 void Resume() override; | 103 void Resume() override; |
103 void Cancel(bool user_cancel) override; | 104 void Cancel(bool user_cancel) override; |
104 void Remove() override; | 105 void Remove() override; |
105 void OpenDownload() override; | 106 void OpenDownload() override; |
106 void ShowDownloadInShell() override; | 107 void ShowDownloadInShell() override; |
107 uint32_t GetId() const override; | 108 uint32_t GetId() const override; |
| 109 const std::string& GetGuid() const override; |
108 DownloadState GetState() const override; | 110 DownloadState GetState() const override; |
109 DownloadInterruptReason GetLastReason() const override; | 111 DownloadInterruptReason GetLastReason() const override; |
110 bool IsPaused() const override; | 112 bool IsPaused() const override; |
111 bool IsTemporary() const override; | 113 bool IsTemporary() const override; |
112 bool CanResume() const override; | 114 bool CanResume() const override; |
113 bool IsDone() const override; | 115 bool IsDone() const override; |
114 const GURL& GetURL() const override; | 116 const GURL& GetURL() const override; |
115 const std::vector<GURL>& GetUrlChain() const override; | 117 const std::vector<GURL>& GetUrlChain() const override; |
116 const GURL& GetOriginalUrl() const override; | 118 const GURL& GetOriginalUrl() const override; |
117 const GURL& GetReferrerUrl() const override; | 119 const GURL& GetReferrerUrl() const override; |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 DownloadInternalState to); | 475 DownloadInternalState to); |
474 | 476 |
475 // Will be false for save package downloads retrieved from the history. | 477 // Will be false for save package downloads retrieved from the history. |
476 // TODO(rdsmith): Replace with a generalized enum for "download source". | 478 // TODO(rdsmith): Replace with a generalized enum for "download source". |
477 const bool is_save_package_download_ = false; | 479 const bool is_save_package_download_ = false; |
478 | 480 |
479 // The handle to the request information. Used for operations outside the | 481 // The handle to the request information. Used for operations outside the |
480 // download system. | 482 // download system. |
481 scoped_ptr<DownloadRequestHandleInterface> request_handle_; | 483 scoped_ptr<DownloadRequestHandleInterface> request_handle_; |
482 | 484 |
| 485 std::string guid_; |
| 486 |
483 uint32_t download_id_ = kInvalidId; | 487 uint32_t download_id_ = kInvalidId; |
484 | 488 |
485 // Display name for the download. If this is empty, then the display name is | 489 // Display name for the download. If this is empty, then the display name is |
486 // considered to be |target_path_.BaseName()|. | 490 // considered to be |target_path_.BaseName()|. |
487 base::FilePath display_name_; | 491 base::FilePath display_name_; |
488 | 492 |
489 // Full path to the downloaded or downloading file. This is the path to the | 493 // Full path to the downloaded or downloading file. This is the path to the |
490 // physical file, if one exists. The final target path is specified by | 494 // physical file, if one exists. The final target path is specified by |
491 // |target_path_|. |current_path_| can be empty if the in-progress path hasn't | 495 // |target_path_|. |current_path_| can be empty if the in-progress path hasn't |
492 // been determined. | 496 // been determined. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 const net::BoundNetLog bound_net_log_; | 642 const net::BoundNetLog bound_net_log_; |
639 | 643 |
640 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 644 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
641 | 645 |
642 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 646 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
643 }; | 647 }; |
644 | 648 |
645 } // namespace content | 649 } // namespace content |
646 | 650 |
647 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 651 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |