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_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 // Will be called asynchronously with the results of the ChooseSavePath | 28 // Will be called asynchronously with the results of the ChooseSavePath |
29 // operation. If the delegate wants notification of the download item created | 29 // operation. If the delegate wants notification of the download item created |
30 // in response to this operation, the SavePackageDownloadCreatedCallback will be | 30 // in response to this operation, the SavePackageDownloadCreatedCallback will be |
31 // non-null. | 31 // non-null. |
32 typedef base::Callback<void(const base::FilePath&, | 32 typedef base::Callback<void(const base::FilePath&, |
33 SavePageType, | 33 SavePageType, |
34 const SavePackageDownloadCreatedCallback&)> | 34 const SavePackageDownloadCreatedCallback&)> |
35 SavePackagePathPickedCallback; | 35 SavePackagePathPickedCallback; |
36 | 36 |
37 // Called with the results of DetermineDownloadTarget(). If the delegate decides | 37 // Called with the results of DetermineDownloadTarget(). |
38 // to cancel the download, then |target_path| should be set to an empty path. If | 38 // |
39 // |target_path| is non-empty, then |intermediate_path| is required to be | 39 // |interrupt_reason| should be set to DOWNLOAD_INTERRUPT_REASON_NONE in |
40 // non-empty and specify the path to the intermediate file (which could be the | 40 // order to proceed with the download. DOWNLOAD_INTERRUPT_REASON_USER_CANCEL |
41 // same as |target_path|). Both |target_path| and |intermediate_path| are | 41 // results in the download being marked cancelled. Any other value results |
42 // expected to in the same directory. | 42 // in the download being marked as interrupted. The other fields are only |
43 typedef base::Callback<void( | 43 // considered valid if |interrupt_reason| is NONE. |
44 const base::FilePath& target_path, | 44 // |
45 DownloadItem::TargetDisposition disposition, | 45 // |target_path| should be set to a non-empty path which is taken to be the |
46 DownloadDangerType danger_type, | 46 // final target path for the download. Any file already at this path will be |
47 const base::FilePath& intermediate_path)> DownloadTargetCallback; | 47 // overwritten. |
| 48 // |
| 49 // |intermediate_path| specifies the path to the intermediate file. The download |
| 50 // will be written to this path until all the bytes have been written. Upon |
| 51 // completion, the file will be renamed to |target_path|. |
| 52 // |intermediate_path| could be the same as |target_path|. Both paths must |
| 53 // be in the same directory. |
| 54 // |
| 55 // |disposition| and |danger_type| are attributes associated with the download |
| 56 // item and can be accessed via the DownloadItem accessors. |
| 57 typedef base::Callback<void(const base::FilePath& target_path, |
| 58 DownloadItem::TargetDisposition disposition, |
| 59 DownloadDangerType danger_type, |
| 60 const base::FilePath& intermediate_path, |
| 61 DownloadInterruptReason interrupt_reason)> |
| 62 DownloadTargetCallback; |
48 | 63 |
49 // Called when a download delayed by the delegate has completed. | 64 // Called when a download delayed by the delegate has completed. |
50 typedef base::Callback<void(bool)> DownloadOpenDelayedCallback; | 65 typedef base::Callback<void(bool)> DownloadOpenDelayedCallback; |
51 | 66 |
52 // Called with the result of CheckForFileExistence(). | 67 // Called with the result of CheckForFileExistence(). |
53 typedef base::Callback<void(bool result)> CheckForFileExistenceCallback; | 68 typedef base::Callback<void(bool result)> CheckForFileExistenceCallback; |
54 | 69 |
55 typedef base::Callback<void(uint32_t)> DownloadIdCallback; | 70 typedef base::Callback<void(uint32_t)> DownloadIdCallback; |
56 | 71 |
57 // Browser's download manager: manages all downloads and destination view. | 72 // Browser's download manager: manages all downloads and destination view. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // This GUID is only used on Windows. | 165 // This GUID is only used on Windows. |
151 virtual std::string ApplicationClientIdForFileScanning() const; | 166 virtual std::string ApplicationClientIdForFileScanning() const; |
152 | 167 |
153 protected: | 168 protected: |
154 virtual ~DownloadManagerDelegate(); | 169 virtual ~DownloadManagerDelegate(); |
155 }; | 170 }; |
156 | 171 |
157 } // namespace content | 172 } // namespace content |
158 | 173 |
159 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 174 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |