| 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_FILE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/download_id.h" | 14 #include "content/public/browser/download_id.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "content/public/browser/download_interrupt_reasons.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class DownloadManager; | 19 class DownloadManager; |
| 20 | 20 |
| 21 // These objects live exclusively on the file thread and handle the writing | 21 // These objects live exclusively on the file thread and handle the writing |
| 22 // operations for one download. These objects live only for the duration that | 22 // operations for one download. These objects live only for the duration that |
| 23 // the download is 'in progress': once the download has been completed or | 23 // the download is 'in progress': once the download has been completed or |
| 24 // cancelled, the DownloadFile is destroyed. | 24 // cancelled, the DownloadFile is destroyed. |
| 25 class CONTENT_EXPORT DownloadFile { | 25 class CONTENT_EXPORT DownloadFile { |
| 26 public: | 26 public: |
| 27 virtual ~DownloadFile() {} | 27 virtual ~DownloadFile() {} |
| 28 | 28 |
| 29 // If calculate_hash is true, sha256 hash will be calculated. | 29 // If calculate_hash is true, sha256 hash will be calculated. |
| 30 // Returns net::OK on success, or a network error code on failure. | 30 // Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a network |
| 31 virtual net::Error Initialize() = 0; | 31 // error code on failure. |
| 32 virtual DownloadInterruptReason Initialize() = 0; |
| 32 | 33 |
| 33 // Rename the download file. | 34 // Rename the download file. |
| 34 // Returns net::OK on success, or a network error code on failure. | 35 // Returns net::OK on success, or a network error code on failure. |
| 35 virtual net::Error Rename(const FilePath& full_path) = 0; | 36 virtual DownloadInterruptReason Rename(const FilePath& full_path) = 0; |
| 36 | 37 |
| 37 // Detach the file so it is not deleted on destruction. | 38 // Detach the file so it is not deleted on destruction. |
| 38 virtual void Detach() = 0; | 39 virtual void Detach() = 0; |
| 39 | 40 |
| 40 // Abort the download and automatically close the file. | 41 // Abort the download and automatically close the file. |
| 41 virtual void Cancel() = 0; | 42 virtual void Cancel() = 0; |
| 42 | 43 |
| 43 // Informs the OS that this file came from the internet. | 44 // Informs the OS that this file came from the internet. |
| 44 virtual void AnnotateWithSourceInformation() = 0; | 45 virtual void AnnotateWithSourceInformation() = 0; |
| 45 | 46 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 virtual int Id() const = 0; | 62 virtual int Id() const = 0; |
| 62 virtual DownloadManager* GetDownloadManager() = 0; | 63 virtual DownloadManager* GetDownloadManager() = 0; |
| 63 virtual const DownloadId& GlobalId() const = 0; | 64 virtual const DownloadId& GlobalId() const = 0; |
| 64 | 65 |
| 65 virtual std::string DebugString() const = 0; | 66 virtual std::string DebugString() const = 0; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace content | 69 } // namespace content |
| 69 | 70 |
| 70 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 71 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
| OLD | NEW |