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 // Each download is represented by a DownloadItem, and all DownloadItems | 5 // Each download is represented by a DownloadItem, and all DownloadItems |
6 // are owned by the DownloadManager which maintains a global list of all | 6 // are owned by the DownloadManager which maintains a global list of all |
7 // downloads. DownloadItems are created when a user initiates a download, | 7 // downloads. DownloadItems are created when a user initiates a download, |
8 // and exist for the duration of the browser life time. | 8 // and exist for the duration of the browser life time. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // temporary or intermediate file (specified by |current_path_|. Once the | 244 // temporary or intermediate file (specified by |current_path_|. Once the |
245 // download completes, we will rename the file to |target_path_|. | 245 // download completes, we will rename the file to |target_path_|. |
246 virtual const FilePath& GetTargetFilePath() const = 0; | 246 virtual const FilePath& GetTargetFilePath() const = 0; |
247 | 247 |
248 // Get the target disposition. | 248 // Get the target disposition. |
249 virtual TargetDisposition GetTargetDisposition() const = 0; | 249 virtual TargetDisposition GetTargetDisposition() const = 0; |
250 | 250 |
251 // Called when the target path has been determined. |target_path| is the | 251 // Called when the target path has been determined. |target_path| is the |
252 // suggested target path. |disposition| indicates how the target path should | 252 // suggested target path. |disposition| indicates how the target path should |
253 // be used (see TargetDisposition). |danger_type| is the danger level of | 253 // be used (see TargetDisposition). |danger_type| is the danger level of |
254 // |target_path| as determined by the caller. If |disposition| is | 254 // |target_path| as determined by the caller. |intermediate_path| is the path |
255 // TARGET_DISPOSITION_PROMPT, then OnTargetPathSelected() should be called | 255 // to use to store the download until OnDownloadCompleting() is called. |
256 // subsequently with the user's selected target path. | 256 virtual void OnDownloadTargetDetermined( |
257 virtual void OnTargetPathDetermined( | |
258 const FilePath& target_path, | 257 const FilePath& target_path, |
259 TargetDisposition disposition, | 258 TargetDisposition disposition, |
260 content::DownloadDangerType danger_type) = 0; | 259 content::DownloadDangerType danger_type, |
261 | 260 const FilePath& intermediate_path) = 0; |
262 // This method should be called if and only if OnTargetPathDetermined() was | |
263 // called previously with disposition set to TARGET_DISPOSITION_PROMPT. | |
264 // |target_path| is the path that the user selected after being prompted for a | |
265 // target path. | |
266 virtual void OnTargetPathSelected(const FilePath& target_path) = 0; | |
267 | 261 |
268 // Called if a check of the download contents was performed and the results of | 262 // Called if a check of the download contents was performed and the results of |
269 // the test are available. This should only be called after AllDataSaved() is | 263 // the test are available. This should only be called after AllDataSaved() is |
270 // true. | 264 // true. |
271 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 265 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; |
272 | 266 |
273 virtual void OnIntermediatePathDetermined(DownloadFileManager* file_manager, | |
274 const FilePath& path) = 0; | |
275 | |
276 virtual void SetIsPersisted() = 0; | 267 virtual void SetIsPersisted() = 0; |
277 virtual bool IsPersisted() const = 0; | 268 virtual bool IsPersisted() const = 0; |
278 | 269 |
279 // Accessors | 270 // Accessors |
280 virtual const std::string& GetHash() const = 0; | 271 virtual const std::string& GetHash() const = 0; |
281 virtual DownloadState GetState() const = 0; | 272 virtual DownloadState GetState() const = 0; |
282 virtual const GURL& GetURL() const = 0; | 273 virtual const GURL& GetURL() const = 0; |
283 virtual const std::vector<GURL>& GetUrlChain() const = 0; | 274 virtual const std::vector<GURL>& GetUrlChain() const = 0; |
284 virtual const GURL& GetOriginalUrl() const = 0; | 275 virtual const GURL& GetOriginalUrl() const = 0; |
285 virtual const GURL& GetReferrerUrl() const = 0; | 276 virtual const GURL& GetReferrerUrl() const = 0; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 virtual void SetExternalData(const void* key, ExternalData* data) = 0; | 358 virtual void SetExternalData(const void* key, ExternalData* data) = 0; |
368 | 359 |
369 virtual std::string DebugString(bool verbose) const = 0; | 360 virtual std::string DebugString(bool verbose) const = 0; |
370 | 361 |
371 virtual void MockDownloadOpenForTesting() = 0; | 362 virtual void MockDownloadOpenForTesting() = 0; |
372 }; | 363 }; |
373 | 364 |
374 } // namespace content | 365 } // namespace content |
375 | 366 |
376 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 367 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |