OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 | 9 |
10 #include "chrome/browser/download/download_path_reservation_tracker.h" | 10 #include "chrome/browser/download/download_path_reservation_tracker.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // |virtual_path| is already a local path, then |virtual_path| should be | 55 // |virtual_path| is already a local path, then |virtual_path| should be |
56 // returned as-is. | 56 // returned as-is. |
57 typedef base::Callback<void(const base::FilePath&)> LocalPathCallback; | 57 typedef base::Callback<void(const base::FilePath&)> LocalPathCallback; |
58 | 58 |
59 // Callback to be invoked after CheckDownloadUrl() completes. The parameter to | 59 // Callback to be invoked after CheckDownloadUrl() completes. The parameter to |
60 // the callback should indicate the danger type of the download based on the | 60 // the callback should indicate the danger type of the download based on the |
61 // results of the URL check. | 61 // results of the URL check. |
62 typedef base::Callback<void(content::DownloadDangerType danger_type)> | 62 typedef base::Callback<void(content::DownloadDangerType danger_type)> |
63 CheckDownloadUrlCallback; | 63 CheckDownloadUrlCallback; |
64 | 64 |
65 // Callback to be invoked after GetFileMimeType() completes. The parameter | |
66 // should be the MIME type of the requested file. If no MIME type can be | |
67 // determined, it should be set to the empty string. | |
68 typedef base::Callback<void(const std::string&)> GetFileMimeTypeCallback; | |
69 | |
70 // Notifies extensions of the impending filename determination. |virtual_path| | 65 // Notifies extensions of the impending filename determination. |virtual_path| |
71 // is the current suggested virtual path. The |callback| should be invoked to | 66 // is the current suggested virtual path. The |callback| should be invoked to |
72 // indicate whether any extensions wish to override the path. | 67 // indicate whether any extensions wish to override the path. |
73 virtual void NotifyExtensions(content::DownloadItem* download, | 68 virtual void NotifyExtensions(content::DownloadItem* download, |
74 const base::FilePath& virtual_path, | 69 const base::FilePath& virtual_path, |
75 const NotifyExtensionsCallback& callback) = 0; | 70 const NotifyExtensionsCallback& callback) = 0; |
76 | 71 |
77 // Reserve |virtual_path|. This is expected to check the following: | 72 // Reserve |virtual_path|. This is expected to check the following: |
78 // - Whether |virtual_path| can be written to by the user. If not, the | 73 // - Whether |virtual_path| can be written to by the user. If not, the |
79 // |virtual_path| can be changed to writeable path if necessary. | 74 // |virtual_path| can be changed to writeable path if necessary. |
(...skipping 28 matching lines...) Expand all Loading... |
108 virtual void DetermineLocalPath(content::DownloadItem* download, | 103 virtual void DetermineLocalPath(content::DownloadItem* download, |
109 const base::FilePath& virtual_path, | 104 const base::FilePath& virtual_path, |
110 const LocalPathCallback& callback) = 0; | 105 const LocalPathCallback& callback) = 0; |
111 | 106 |
112 // Check whether the download URL is malicious and invoke |callback| with a | 107 // Check whether the download URL is malicious and invoke |callback| with a |
113 // suggested danger type for the download. | 108 // suggested danger type for the download. |
114 virtual void CheckDownloadUrl(content::DownloadItem* download, | 109 virtual void CheckDownloadUrl(content::DownloadItem* download, |
115 const base::FilePath& virtual_path, | 110 const base::FilePath& virtual_path, |
116 const CheckDownloadUrlCallback& callback) = 0; | 111 const CheckDownloadUrlCallback& callback) = 0; |
117 | 112 |
118 // Get the MIME type for the given file. | |
119 virtual void GetFileMimeType(const base::FilePath& path, | |
120 const GetFileMimeTypeCallback& callback) = 0; | |
121 protected: | 113 protected: |
122 virtual ~DownloadTargetDeterminerDelegate(); | 114 virtual ~DownloadTargetDeterminerDelegate(); |
123 }; | 115 }; |
124 | 116 |
125 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ | 117 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ |
OLD | NEW |