| 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 |
| 65 // Notifies extensions of the impending filename determination. |virtual_path| | 70 // Notifies extensions of the impending filename determination. |virtual_path| |
| 66 // is the current suggested virtual path. The |callback| should be invoked to | 71 // is the current suggested virtual path. The |callback| should be invoked to |
| 67 // indicate whether any extensions wish to override the path. | 72 // indicate whether any extensions wish to override the path. |
| 68 virtual void NotifyExtensions(content::DownloadItem* download, | 73 virtual void NotifyExtensions(content::DownloadItem* download, |
| 69 const base::FilePath& virtual_path, | 74 const base::FilePath& virtual_path, |
| 70 const NotifyExtensionsCallback& callback) = 0; | 75 const NotifyExtensionsCallback& callback) = 0; |
| 71 | 76 |
| 72 // Reserve |virtual_path|. This is expected to check the following: | 77 // Reserve |virtual_path|. This is expected to check the following: |
| 73 // - Whether |virtual_path| can be written to by the user. If not, the | 78 // - Whether |virtual_path| can be written to by the user. If not, the |
| 74 // |virtual_path| can be changed to writeable path if necessary. | 79 // |virtual_path| can be changed to writeable path if necessary. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 103 virtual void DetermineLocalPath(content::DownloadItem* download, | 108 virtual void DetermineLocalPath(content::DownloadItem* download, |
| 104 const base::FilePath& virtual_path, | 109 const base::FilePath& virtual_path, |
| 105 const LocalPathCallback& callback) = 0; | 110 const LocalPathCallback& callback) = 0; |
| 106 | 111 |
| 107 // Check whether the download URL is malicious and invoke |callback| with a | 112 // Check whether the download URL is malicious and invoke |callback| with a |
| 108 // suggested danger type for the download. | 113 // suggested danger type for the download. |
| 109 virtual void CheckDownloadUrl(content::DownloadItem* download, | 114 virtual void CheckDownloadUrl(content::DownloadItem* download, |
| 110 const base::FilePath& virtual_path, | 115 const base::FilePath& virtual_path, |
| 111 const CheckDownloadUrlCallback& callback) = 0; | 116 const CheckDownloadUrlCallback& callback) = 0; |
| 112 | 117 |
| 118 // Get the MIME type for the given file. |
| 119 virtual void GetFileMimeType(const base::FilePath& path, |
| 120 const GetFileMimeTypeCallback& callback) = 0; |
| 113 protected: | 121 protected: |
| 114 virtual ~DownloadTargetDeterminerDelegate(); | 122 virtual ~DownloadTargetDeterminerDelegate(); |
| 115 }; | 123 }; |
| 116 | 124 |
| 117 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ | 125 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_ |
| OLD | NEW |