| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const base::Time& end_time, | 67 const base::Time& end_time, |
| 68 const std::string& etag, | 68 const std::string& etag, |
| 69 const std::string& last_modified, | 69 const std::string& last_modified, |
| 70 int64_t received_bytes, | 70 int64_t received_bytes, |
| 71 int64_t total_bytes, | 71 int64_t total_bytes, |
| 72 const std::string& hash, | 72 const std::string& hash, |
| 73 DownloadItem::DownloadState state, | 73 DownloadItem::DownloadState state, |
| 74 DownloadDangerType danger_type, | 74 DownloadDangerType danger_type, |
| 75 DownloadInterruptReason interrupt_reason, | 75 DownloadInterruptReason interrupt_reason, |
| 76 bool opened, | 76 bool opened, |
| 77 const base::Time& last_access_time, |
| 77 const net::NetLogWithSource& net_log); | 78 const net::NetLogWithSource& net_log); |
| 78 | 79 |
| 79 // Constructing for a regular download. | 80 // Constructing for a regular download. |
| 80 // |net_log| is constructed externally for our use. | 81 // |net_log| is constructed externally for our use. |
| 81 DownloadItemImpl(DownloadItemImplDelegate* delegate, | 82 DownloadItemImpl(DownloadItemImplDelegate* delegate, |
| 82 uint32_t id, | 83 uint32_t id, |
| 83 const DownloadCreateInfo& info, | 84 const DownloadCreateInfo& info, |
| 84 const net::NetLogWithSource& net_log); | 85 const net::NetLogWithSource& net_log); |
| 85 | 86 |
| 86 // Constructing for the "Save Page As..." feature: | 87 // Constructing for the "Save Page As..." feature: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 int64_t GetTotalBytes() const override; | 152 int64_t GetTotalBytes() const override; |
| 152 int64_t GetReceivedBytes() const override; | 153 int64_t GetReceivedBytes() const override; |
| 153 base::Time GetStartTime() const override; | 154 base::Time GetStartTime() const override; |
| 154 base::Time GetEndTime() const override; | 155 base::Time GetEndTime() const override; |
| 155 bool CanShowInFolder() override; | 156 bool CanShowInFolder() override; |
| 156 bool CanOpenDownload() override; | 157 bool CanOpenDownload() override; |
| 157 bool ShouldOpenFileBasedOnExtension() override; | 158 bool ShouldOpenFileBasedOnExtension() override; |
| 158 bool GetOpenWhenComplete() const override; | 159 bool GetOpenWhenComplete() const override; |
| 159 bool GetAutoOpened() override; | 160 bool GetAutoOpened() override; |
| 160 bool GetOpened() const override; | 161 bool GetOpened() const override; |
| 162 base::Time GetLastAccessTime() const override; |
| 161 BrowserContext* GetBrowserContext() const override; | 163 BrowserContext* GetBrowserContext() const override; |
| 162 WebContents* GetWebContents() const override; | 164 WebContents* GetWebContents() const override; |
| 163 void OnContentCheckCompleted(DownloadDangerType danger_type) override; | 165 void OnContentCheckCompleted(DownloadDangerType danger_type) override; |
| 164 void SetOpenWhenComplete(bool open) override; | 166 void SetOpenWhenComplete(bool open) override; |
| 165 void SetOpened(bool opened) override; | 167 void SetOpened(bool opened) override; |
| 168 void UpdateLastAccessTime() override; |
| 166 void SetDisplayName(const base::FilePath& name) override; | 169 void SetDisplayName(const base::FilePath& name) override; |
| 167 std::string DebugString(bool verbose) const override; | 170 std::string DebugString(bool verbose) const override; |
| 168 | 171 |
| 169 // All remaining public interfaces virtual to allow for DownloadItemImpl | 172 // All remaining public interfaces virtual to allow for DownloadItemImpl |
| 170 // mocks. | 173 // mocks. |
| 171 | 174 |
| 172 // Determines the resume mode for an interrupted download. Requires | 175 // Determines the resume mode for an interrupted download. Requires |
| 173 // last_reason_ to be set, but doesn't require the download to be in | 176 // last_reason_ to be set, but doesn't require the download to be in |
| 174 // INTERRUPTED state. | 177 // INTERRUPTED state. |
| 175 virtual ResumeMode GetResumeMode() const; | 178 virtual ResumeMode GetResumeMode() const; |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 613 |
| 611 // True if the item was downloaded temporarily. | 614 // True if the item was downloaded temporarily. |
| 612 bool is_temporary_ = false; | 615 bool is_temporary_ = false; |
| 613 | 616 |
| 614 // Did the user open the item either directly or indirectly (such as by | 617 // Did the user open the item either directly or indirectly (such as by |
| 615 // setting always open files of this type)? The shelf also sets this field | 618 // setting always open files of this type)? The shelf also sets this field |
| 616 // when the user closes the shelf before the item has been opened but should | 619 // when the user closes the shelf before the item has been opened but should |
| 617 // be treated as though the user opened it. | 620 // be treated as though the user opened it. |
| 618 bool opened_ = false; | 621 bool opened_ = false; |
| 619 | 622 |
| 623 // Time when the download was last accessed. |
| 624 base::Time last_access_time_; |
| 625 |
| 620 // Did the delegate delay calling Complete on this download? | 626 // Did the delegate delay calling Complete on this download? |
| 621 bool delegate_delayed_complete_ = false; | 627 bool delegate_delayed_complete_ = false; |
| 622 | 628 |
| 623 // Error return from DestinationError. Stored separately from | 629 // Error return from DestinationError. Stored separately from |
| 624 // last_reason_ so that we can avoid handling destination errors until | 630 // last_reason_ so that we can avoid handling destination errors until |
| 625 // after file name determination has occurred. | 631 // after file name determination has occurred. |
| 626 DownloadInterruptReason destination_error_ = DOWNLOAD_INTERRUPT_REASON_NONE; | 632 DownloadInterruptReason destination_error_ = DOWNLOAD_INTERRUPT_REASON_NONE; |
| 627 | 633 |
| 628 // The following fields describe the current state of the download file. | 634 // The following fields describe the current state of the download file. |
| 629 | 635 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 const net::NetLogWithSource net_log_; | 684 const net::NetLogWithSource net_log_; |
| 679 | 685 |
| 680 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 686 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
| 681 | 687 |
| 682 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 688 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
| 683 }; | 689 }; |
| 684 | 690 |
| 685 } // namespace content | 691 } // namespace content |
| 686 | 692 |
| 687 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 693 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
| OLD | NEW |