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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // Callback used with Rename*(). On a successful rename |reason| will be | 32 // Callback used with Rename*(). On a successful rename |reason| will be |
33 // DOWNLOAD_INTERRUPT_REASON_NONE and |path| the path the rename | 33 // DOWNLOAD_INTERRUPT_REASON_NONE and |path| the path the rename |
34 // was done to. On a failed rename, |reason| will contain the | 34 // was done to. On a failed rename, |reason| will contain the |
35 // error. | 35 // error. |
36 typedef base::Callback<void(DownloadInterruptReason reason, | 36 typedef base::Callback<void(DownloadInterruptReason reason, |
37 const FilePath& path)> RenameCompletionCallback; | 37 const FilePath& path)> RenameCompletionCallback; |
38 | 38 |
39 virtual ~DownloadFile() {} | 39 virtual ~DownloadFile() {} |
40 | 40 |
41 // Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a network | 41 // Upon completion, |callback| will be called on the UI |
42 // error code on failure. Upon completion, |callback| will be | 42 // thread as per the comment above, passing DOWNLOAD_INTERRUPT_REASON_NONE |
43 // called on the UI thread as per the comment above. | 43 // on success, or a network download interrupt reason on failure. |
44 virtual void Initialize(const InitializeCallback& callback) = 0; | 44 virtual void Initialize(const InitializeCallback& callback) = 0; |
45 | 45 |
46 // Rename the download file to |full_path|. If that file exists | 46 // Rename the download file to |full_path|. If that file exists |
47 // |full_path| will be uniquified by suffixing " (<number>)" to the | 47 // |full_path| will be uniquified by suffixing " (<number>)" to the |
48 // file name before the extension. | 48 // file name before the extension. |
49 virtual void RenameAndUniquify(const FilePath& full_path, | 49 virtual void RenameAndUniquify(const FilePath& full_path, |
50 const RenameCompletionCallback& callback) = 0; | 50 const RenameCompletionCallback& callback) = 0; |
51 | 51 |
52 // Rename the download file to |full_path| and annotate it with | 52 // Rename the download file to |full_path| and annotate it with |
53 // "Mark of the Web" information about its source. No uniquification | 53 // "Mark of the Web" information about its source. No uniquification |
(...skipping 25 matching lines...) Expand all Loading... |
79 // which keeps track of the number of DownloadFiles. | 79 // which keeps track of the number of DownloadFiles. |
80 static int GetNumberOfDownloadFiles(); | 80 static int GetNumberOfDownloadFiles(); |
81 | 81 |
82 protected: | 82 protected: |
83 static int number_active_objects_; | 83 static int number_active_objects_; |
84 }; | 84 }; |
85 | 85 |
86 } // namespace content | 86 } // namespace content |
87 | 87 |
88 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ | 88 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H_ |
OLD | NEW |