| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ | 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // downloads. | 52 // downloads. |
| 53 class DownloadControllerBase : public content::DownloadItem::Observer { | 53 class DownloadControllerBase : public content::DownloadItem::Observer { |
| 54 public: | 54 public: |
| 55 // Returns the singleton instance of the DownloadControllerBase. | 55 // Returns the singleton instance of the DownloadControllerBase. |
| 56 static DownloadControllerBase* Get(); | 56 static DownloadControllerBase* Get(); |
| 57 | 57 |
| 58 // Called to set the DownloadControllerBase instance. | 58 // Called to set the DownloadControllerBase instance. |
| 59 static void SetDownloadControllerBase( | 59 static void SetDownloadControllerBase( |
| 60 DownloadControllerBase* download_controller); | 60 DownloadControllerBase* download_controller); |
| 61 | 61 |
| 62 // Starts a new download request with Android. Should be called on the | |
| 63 // UI thread. | |
| 64 virtual void CreateGETDownload( | |
| 65 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | |
| 66 bool must_download, | |
| 67 const DownloadInfo& info) = 0; | |
| 68 | |
| 69 // Should be called when a download is started. It can be either a GET | 62 // Should be called when a download is started. It can be either a GET |
| 70 // request with authentication or a POST request. Notifies the embedding | 63 // request with authentication or a POST request. Notifies the embedding |
| 71 // app about the download. Should be called on the UI thread. | 64 // app about the download. Should be called on the UI thread. |
| 72 virtual void OnDownloadStarted(content::DownloadItem* download_item) = 0; | 65 virtual void OnDownloadStarted(content::DownloadItem* download_item) = 0; |
| 73 | 66 |
| 74 // Called when a download is initiated by context menu. | 67 // Called when a download is initiated by context menu. |
| 75 virtual void StartContextMenuDownload( | 68 virtual void StartContextMenuDownload( |
| 76 const content::ContextMenuParams& params, | 69 const content::ContextMenuParams& params, |
| 77 content::WebContents* web_contents, | 70 content::WebContents* web_contents, |
| 78 bool is_link, const std::string& extra_headers) = 0; | 71 bool is_link, const std::string& extra_headers) = 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 98 // Called to set the default download file name if it cannot be resolved | 91 // Called to set the default download file name if it cannot be resolved |
| 99 // from url and content disposition | 92 // from url and content disposition |
| 100 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} | 93 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} |
| 101 | 94 |
| 102 protected: | 95 protected: |
| 103 ~DownloadControllerBase() override {} | 96 ~DownloadControllerBase() override {} |
| 104 static DownloadControllerBase* download_controller_; | 97 static DownloadControllerBase* download_controller_; |
| 105 }; | 98 }; |
| 106 | 99 |
| 107 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ | 100 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ |
| OLD | NEW |