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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 uint32 id, | 83 uint32 id, |
84 const base::FilePath& path, | 84 const base::FilePath& path, |
85 const GURL& url, | 85 const GURL& url, |
86 const std::string& mime_type, | 86 const std::string& mime_type, |
87 scoped_ptr<DownloadRequestHandleInterface> request_handle, | 87 scoped_ptr<DownloadRequestHandleInterface> request_handle, |
88 const net::BoundNetLog& bound_net_log); | 88 const net::BoundNetLog& bound_net_log); |
89 | 89 |
90 virtual ~DownloadItemImpl(); | 90 virtual ~DownloadItemImpl(); |
91 | 91 |
92 // DownloadItem | 92 // DownloadItem |
93 virtual void AddObserver(DownloadItem::Observer* observer) OVERRIDE; | 93 virtual void AddObserver(DownloadItem::Observer* observer) override; |
94 virtual void RemoveObserver(DownloadItem::Observer* observer) OVERRIDE; | 94 virtual void RemoveObserver(DownloadItem::Observer* observer) override; |
95 virtual void UpdateObservers() OVERRIDE; | 95 virtual void UpdateObservers() override; |
96 virtual void ValidateDangerousDownload() OVERRIDE; | 96 virtual void ValidateDangerousDownload() override; |
97 virtual void StealDangerousDownload(const AcquireFileCallback& callback) | 97 virtual void StealDangerousDownload(const AcquireFileCallback& callback) |
98 OVERRIDE; | 98 override; |
99 virtual void Pause() OVERRIDE; | 99 virtual void Pause() override; |
100 virtual void Resume() OVERRIDE; | 100 virtual void Resume() override; |
101 virtual void Cancel(bool user_cancel) OVERRIDE; | 101 virtual void Cancel(bool user_cancel) override; |
102 virtual void Remove() OVERRIDE; | 102 virtual void Remove() override; |
103 virtual void OpenDownload() OVERRIDE; | 103 virtual void OpenDownload() override; |
104 virtual void ShowDownloadInShell() OVERRIDE; | 104 virtual void ShowDownloadInShell() override; |
105 virtual uint32 GetId() const OVERRIDE; | 105 virtual uint32 GetId() const override; |
106 virtual DownloadState GetState() const OVERRIDE; | 106 virtual DownloadState GetState() const override; |
107 virtual DownloadInterruptReason GetLastReason() const OVERRIDE; | 107 virtual DownloadInterruptReason GetLastReason() const override; |
108 virtual bool IsPaused() const OVERRIDE; | 108 virtual bool IsPaused() const override; |
109 virtual bool IsTemporary() const OVERRIDE; | 109 virtual bool IsTemporary() const override; |
110 virtual bool CanResume() const OVERRIDE; | 110 virtual bool CanResume() const override; |
111 virtual bool IsDone() const OVERRIDE; | 111 virtual bool IsDone() const override; |
112 virtual const GURL& GetURL() const OVERRIDE; | 112 virtual const GURL& GetURL() const override; |
113 virtual const std::vector<GURL>& GetUrlChain() const OVERRIDE; | 113 virtual const std::vector<GURL>& GetUrlChain() const override; |
114 virtual const GURL& GetOriginalUrl() const OVERRIDE; | 114 virtual const GURL& GetOriginalUrl() const override; |
115 virtual const GURL& GetReferrerUrl() const OVERRIDE; | 115 virtual const GURL& GetReferrerUrl() const override; |
116 virtual const GURL& GetTabUrl() const OVERRIDE; | 116 virtual const GURL& GetTabUrl() const override; |
117 virtual const GURL& GetTabReferrerUrl() const OVERRIDE; | 117 virtual const GURL& GetTabReferrerUrl() const override; |
118 virtual std::string GetSuggestedFilename() const OVERRIDE; | 118 virtual std::string GetSuggestedFilename() const override; |
119 virtual std::string GetContentDisposition() const OVERRIDE; | 119 virtual std::string GetContentDisposition() const override; |
120 virtual std::string GetMimeType() const OVERRIDE; | 120 virtual std::string GetMimeType() const override; |
121 virtual std::string GetOriginalMimeType() const OVERRIDE; | 121 virtual std::string GetOriginalMimeType() const override; |
122 virtual std::string GetRemoteAddress() const OVERRIDE; | 122 virtual std::string GetRemoteAddress() const override; |
123 virtual bool HasUserGesture() const OVERRIDE; | 123 virtual bool HasUserGesture() const override; |
124 virtual ui::PageTransition GetTransitionType() const OVERRIDE; | 124 virtual ui::PageTransition GetTransitionType() const override; |
125 virtual const std::string& GetLastModifiedTime() const OVERRIDE; | 125 virtual const std::string& GetLastModifiedTime() const override; |
126 virtual const std::string& GetETag() const OVERRIDE; | 126 virtual const std::string& GetETag() const override; |
127 virtual bool IsSavePackageDownload() const OVERRIDE; | 127 virtual bool IsSavePackageDownload() const override; |
128 virtual const base::FilePath& GetFullPath() const OVERRIDE; | 128 virtual const base::FilePath& GetFullPath() const override; |
129 virtual const base::FilePath& GetTargetFilePath() const OVERRIDE; | 129 virtual const base::FilePath& GetTargetFilePath() const override; |
130 virtual const base::FilePath& GetForcedFilePath() const OVERRIDE; | 130 virtual const base::FilePath& GetForcedFilePath() const override; |
131 virtual base::FilePath GetFileNameToReportUser() const OVERRIDE; | 131 virtual base::FilePath GetFileNameToReportUser() const override; |
132 virtual TargetDisposition GetTargetDisposition() const OVERRIDE; | 132 virtual TargetDisposition GetTargetDisposition() const override; |
133 virtual const std::string& GetHash() const OVERRIDE; | 133 virtual const std::string& GetHash() const override; |
134 virtual const std::string& GetHashState() const OVERRIDE; | 134 virtual const std::string& GetHashState() const override; |
135 virtual bool GetFileExternallyRemoved() const OVERRIDE; | 135 virtual bool GetFileExternallyRemoved() const override; |
136 virtual void DeleteFile(const base::Callback<void(bool)>& callback) OVERRIDE; | 136 virtual void DeleteFile(const base::Callback<void(bool)>& callback) override; |
137 virtual bool IsDangerous() const OVERRIDE; | 137 virtual bool IsDangerous() const override; |
138 virtual DownloadDangerType GetDangerType() const OVERRIDE; | 138 virtual DownloadDangerType GetDangerType() const override; |
139 virtual bool TimeRemaining(base::TimeDelta* remaining) const OVERRIDE; | 139 virtual bool TimeRemaining(base::TimeDelta* remaining) const override; |
140 virtual int64 CurrentSpeed() const OVERRIDE; | 140 virtual int64 CurrentSpeed() const override; |
141 virtual int PercentComplete() const OVERRIDE; | 141 virtual int PercentComplete() const override; |
142 virtual bool AllDataSaved() const OVERRIDE; | 142 virtual bool AllDataSaved() const override; |
143 virtual int64 GetTotalBytes() const OVERRIDE; | 143 virtual int64 GetTotalBytes() const override; |
144 virtual int64 GetReceivedBytes() const OVERRIDE; | 144 virtual int64 GetReceivedBytes() const override; |
145 virtual base::Time GetStartTime() const OVERRIDE; | 145 virtual base::Time GetStartTime() const override; |
146 virtual base::Time GetEndTime() const OVERRIDE; | 146 virtual base::Time GetEndTime() const override; |
147 virtual bool CanShowInFolder() OVERRIDE; | 147 virtual bool CanShowInFolder() override; |
148 virtual bool CanOpenDownload() OVERRIDE; | 148 virtual bool CanOpenDownload() override; |
149 virtual bool ShouldOpenFileBasedOnExtension() OVERRIDE; | 149 virtual bool ShouldOpenFileBasedOnExtension() override; |
150 virtual bool GetOpenWhenComplete() const OVERRIDE; | 150 virtual bool GetOpenWhenComplete() const override; |
151 virtual bool GetAutoOpened() OVERRIDE; | 151 virtual bool GetAutoOpened() override; |
152 virtual bool GetOpened() const OVERRIDE; | 152 virtual bool GetOpened() const override; |
153 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 153 virtual BrowserContext* GetBrowserContext() const override; |
154 virtual WebContents* GetWebContents() const OVERRIDE; | 154 virtual WebContents* GetWebContents() const override; |
155 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) OVERRIDE; | 155 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) override; |
156 virtual void SetOpenWhenComplete(bool open) OVERRIDE; | 156 virtual void SetOpenWhenComplete(bool open) override; |
157 virtual void SetIsTemporary(bool temporary) OVERRIDE; | 157 virtual void SetIsTemporary(bool temporary) override; |
158 virtual void SetOpened(bool opened) OVERRIDE; | 158 virtual void SetOpened(bool opened) override; |
159 virtual void SetDisplayName(const base::FilePath& name) OVERRIDE; | 159 virtual void SetDisplayName(const base::FilePath& name) override; |
160 virtual std::string DebugString(bool verbose) const OVERRIDE; | 160 virtual std::string DebugString(bool verbose) const override; |
161 | 161 |
162 // All remaining public interfaces virtual to allow for DownloadItemImpl | 162 // All remaining public interfaces virtual to allow for DownloadItemImpl |
163 // mocks. | 163 // mocks. |
164 | 164 |
165 // Determines the resume mode for an interrupted download. Requires | 165 // Determines the resume mode for an interrupted download. Requires |
166 // last_reason_ to be set, but doesn't require the download to be in | 166 // last_reason_ to be set, but doesn't require the download to be in |
167 // INTERRUPTED state. | 167 // INTERRUPTED state. |
168 virtual ResumeMode GetResumeMode() const; | 168 virtual ResumeMode GetResumeMode() const; |
169 | 169 |
170 // Notify the download item that new origin information is available due to a | 170 // Notify the download item that new origin information is available due to a |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 virtual void OnAllDataSaved(const std::string& final_hash); | 206 virtual void OnAllDataSaved(const std::string& final_hash); |
207 | 207 |
208 // Called by SavePackage to display progress when the DownloadItem | 208 // Called by SavePackage to display progress when the DownloadItem |
209 // should be considered complete. | 209 // should be considered complete. |
210 virtual void MarkAsComplete(); | 210 virtual void MarkAsComplete(); |
211 | 211 |
212 // DownloadDestinationObserver | 212 // DownloadDestinationObserver |
213 virtual void DestinationUpdate(int64 bytes_so_far, | 213 virtual void DestinationUpdate(int64 bytes_so_far, |
214 int64 bytes_per_sec, | 214 int64 bytes_per_sec, |
215 const std::string& hash_state) OVERRIDE; | 215 const std::string& hash_state) override; |
216 virtual void DestinationError(DownloadInterruptReason reason) OVERRIDE; | 216 virtual void DestinationError(DownloadInterruptReason reason) override; |
217 virtual void DestinationCompleted(const std::string& final_hash) OVERRIDE; | 217 virtual void DestinationCompleted(const std::string& final_hash) override; |
218 | 218 |
219 private: | 219 private: |
220 // Fine grained states of a download. Note that active downloads are created | 220 // Fine grained states of a download. Note that active downloads are created |
221 // in IN_PROGRESS_INTERNAL state. However, downloads creates via history can | 221 // in IN_PROGRESS_INTERNAL state. However, downloads creates via history can |
222 // be created in COMPLETE_INTERNAL, CANCELLED_INTERNAL and | 222 // be created in COMPLETE_INTERNAL, CANCELLED_INTERNAL and |
223 // INTERRUPTED_INTERNAL. | 223 // INTERRUPTED_INTERNAL. |
224 | 224 |
225 enum DownloadInternalState { | 225 enum DownloadInternalState { |
226 // Includes both before and after file name determination, and paused | 226 // Includes both before and after file name determination, and paused |
227 // downloads. | 227 // downloads. |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 const net::BoundNetLog bound_net_log_; | 553 const net::BoundNetLog bound_net_log_; |
554 | 554 |
555 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 555 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
556 | 556 |
557 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 557 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
558 }; | 558 }; |
559 | 559 |
560 } // namespace content | 560 } // namespace content |
561 | 561 |
562 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 562 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |