| 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_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/download_item.h" | 10 #include "content/public/browser/download_item.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // request with authentication or a POST request. Notifies the embedding | 34 // request with authentication or a POST request. Notifies the embedding |
| 35 // app about the download. Should be called on the UI thread. | 35 // app about the download. Should be called on the UI thread. |
| 36 virtual void OnDownloadStarted(DownloadItem* download_item) = 0; | 36 virtual void OnDownloadStarted(DownloadItem* download_item) = 0; |
| 37 | 37 |
| 38 // Called when a download is initiated by context menu. | 38 // Called when a download is initiated by context menu. |
| 39 virtual void StartContextMenuDownload( | 39 virtual void StartContextMenuDownload( |
| 40 const ContextMenuParams& params, WebContents* web_contents, | 40 const ContextMenuParams& params, WebContents* web_contents, |
| 41 bool is_link, const std::string& extra_headers) = 0; | 41 bool is_link, const std::string& extra_headers) = 0; |
| 42 | 42 |
| 43 // Called when a dangerous download item is verified or rejected. | 43 // Called when a dangerous download item is verified or rejected. |
| 44 virtual void DangerousDownloadValidated( | 44 virtual void DangerousDownloadValidated(WebContents* web_contents, |
| 45 WebContents* web_contents, int download_id, bool accept) = 0; | 45 const std::string& download_guid, |
| 46 bool accept) = 0; |
| 46 | 47 |
| 47 // Callback when user permission prompt finishes. Args: whether file access | 48 // Callback when user permission prompt finishes. Args: whether file access |
| 48 // permission is acquired. | 49 // permission is acquired. |
| 49 typedef base::Callback<void(bool)> AcquireFileAccessPermissionCallback; | 50 typedef base::Callback<void(bool)> AcquireFileAccessPermissionCallback; |
| 50 | 51 |
| 51 // Called to prompt the user for file access permission. When finished, | 52 // Called to prompt the user for file access permission. When finished, |
| 52 // |callback| will be executed. | 53 // |callback| will be executed. |
| 53 virtual void AcquireFileAccessPermission( | 54 virtual void AcquireFileAccessPermission( |
| 54 WebContents* web_contents, | 55 WebContents* web_contents, |
| 55 const AcquireFileAccessPermissionCallback& callback) = 0; | 56 const AcquireFileAccessPermissionCallback& callback) = 0; |
| 56 | 57 |
| 57 // Called by unit test to approve or disapprove file access request. | 58 // Called by unit test to approve or disapprove file access request. |
| 58 virtual void SetApproveFileAccessRequestForTesting(bool approve) {}; | 59 virtual void SetApproveFileAccessRequestForTesting(bool approve) {}; |
| 59 | 60 |
| 60 // Called to set the default download file name if it cannot be resolved | 61 // Called to set the default download file name if it cannot be resolved |
| 61 // from url and content disposition | 62 // from url and content disposition |
| 62 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} | 63 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} |
| 63 | 64 |
| 64 protected: | 65 protected: |
| 65 ~DownloadControllerAndroid() override {}; | 66 ~DownloadControllerAndroid() override {}; |
| 66 static DownloadControllerAndroid* download_controller_; | 67 static DownloadControllerAndroid* download_controller_; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace content | 70 } // namespace content |
| 70 | 71 |
| 71 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ | 72 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ |
| OLD | NEW |