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 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
14 #include "content/public/browser/download_interrupt_reasons.h" | 15 #include "content/public/browser/download_interrupt_reasons.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 class DownloadManager; | 19 class DownloadManager; |
19 | 20 |
20 // 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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const RenameCompletionCallback& callback) = 0; | 58 const RenameCompletionCallback& callback) = 0; |
58 | 59 |
59 // Detach the file so it is not deleted on destruction. | 60 // Detach the file so it is not deleted on destruction. |
60 virtual void Detach() = 0; | 61 virtual void Detach() = 0; |
61 | 62 |
62 // Abort the download and automatically close the file. | 63 // Abort the download and automatically close the file. |
63 virtual void Cancel() = 0; | 64 virtual void Cancel() = 0; |
64 | 65 |
65 virtual base::FilePath FullPath() const = 0; | 66 virtual base::FilePath FullPath() const = 0; |
66 virtual bool InProgress() const = 0; | 67 virtual bool InProgress() const = 0; |
67 virtual int64 CurrentSpeed() const = 0; | 68 virtual int64_t CurrentSpeed() const = 0; |
68 | 69 |
69 // Set |hash| with sha256 digest for the file. | 70 // Set |hash| with sha256 digest for the file. |
70 // Returns true if digest is successfully calculated. | 71 // Returns true if digest is successfully calculated. |
71 virtual bool GetHash(std::string* hash) = 0; | 72 virtual bool GetHash(std::string* hash) = 0; |
72 | 73 |
73 // Returns the current (intermediate) state of the hash as a byte string. | 74 // Returns the current (intermediate) state of the hash as a byte string. |
74 virtual std::string GetHashState() = 0; | 75 virtual std::string GetHashState() = 0; |
75 | 76 |
76 // Set the application GUID to be used to identify the app to the | 77 // Set the application GUID to be used to identify the app to the |
77 // system AV function when scanning downloaded files. Should be called | 78 // system AV function when scanning downloaded files. Should be called |
78 // before RenameAndAnnotate() to take effect. | 79 // before RenameAndAnnotate() to take effect. |
79 virtual void SetClientGuid(const std::string& guid) = 0; | 80 virtual void SetClientGuid(const std::string& guid) = 0; |
80 | 81 |
81 // For testing. Must be called on FILE thread. | 82 // For testing. Must be called on FILE thread. |
82 // TODO(rdsmith): Replace use of EnsureNoPendingDownloads() | 83 // TODO(rdsmith): Replace use of EnsureNoPendingDownloads() |
83 // on the DownloadManager with a test-specific DownloadFileFactory | 84 // on the DownloadManager with a test-specific DownloadFileFactory |
84 // which keeps track of the number of DownloadFiles. | 85 // which keeps track of the number of DownloadFiles. |
85 static int GetNumberOfDownloadFiles(); | 86 static int GetNumberOfDownloadFiles(); |
86 | 87 |
87 protected: | 88 protected: |
88 static int number_active_objects_; | 89 static int number_active_objects_; |
89 }; | 90 }; |
90 | 91 |
91 } // namespace content | 92 } // namespace content |
92 | 93 |
93 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 94 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
OLD | NEW |