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" |
11 #include "content/public/browser/download_item.h" | 11 #include "content/public/browser/download_item.h" |
| 12 #include "content/public/browser/resource_request_info.h" |
12 #include "content/public/common/context_menu_params.h" | 13 #include "content/public/common/context_menu_params.h" |
13 #include "net/http/http_content_disposition.h" | 14 #include "net/http/http_content_disposition.h" |
14 #include "net/http/http_request_headers.h" | 15 #include "net/http/http_request_headers.h" |
15 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 class URLRequest; | 20 class URLRequest; |
20 } | 21 } |
21 | 22 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 public: | 54 public: |
54 // Returns the singleton instance of the DownloadControllerBase. | 55 // Returns the singleton instance of the DownloadControllerBase. |
55 static DownloadControllerBase* Get(); | 56 static DownloadControllerBase* Get(); |
56 | 57 |
57 // Called to set the DownloadControllerBase instance. | 58 // Called to set the DownloadControllerBase instance. |
58 static void SetDownloadControllerBase( | 59 static void SetDownloadControllerBase( |
59 DownloadControllerBase* download_controller); | 60 DownloadControllerBase* download_controller); |
60 | 61 |
61 // Starts a new download request with Android. Should be called on the | 62 // Starts a new download request with Android. Should be called on the |
62 // UI thread. | 63 // UI thread. |
63 virtual void CreateGETDownload(int render_process_id, int render_view_id, | 64 virtual void CreateGETDownload( |
64 bool must_download, | 65 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
65 const DownloadInfo& info) = 0; | 66 bool must_download, |
| 67 const DownloadInfo& info) = 0; |
66 | 68 |
67 // Should be called when a download is started. It can be either a GET | 69 // Should be called when a download is started. It can be either a GET |
68 // request with authentication or a POST request. Notifies the embedding | 70 // request with authentication or a POST request. Notifies the embedding |
69 // app about the download. Should be called on the UI thread. | 71 // app about the download. Should be called on the UI thread. |
70 virtual void OnDownloadStarted(content::DownloadItem* download_item) = 0; | 72 virtual void OnDownloadStarted(content::DownloadItem* download_item) = 0; |
71 | 73 |
72 // Called when a download is initiated by context menu. | 74 // Called when a download is initiated by context menu. |
73 virtual void StartContextMenuDownload( | 75 virtual void StartContextMenuDownload( |
74 const content::ContextMenuParams& params, | 76 const content::ContextMenuParams& params, |
75 content::WebContents* web_contents, | 77 content::WebContents* web_contents, |
(...skipping 20 matching lines...) Expand all Loading... |
96 // Called to set the default download file name if it cannot be resolved | 98 // Called to set the default download file name if it cannot be resolved |
97 // from url and content disposition | 99 // from url and content disposition |
98 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} | 100 virtual void SetDefaultDownloadFileName(const std::string& file_name) {} |
99 | 101 |
100 protected: | 102 protected: |
101 ~DownloadControllerBase() override {} | 103 ~DownloadControllerBase() override {} |
102 static DownloadControllerBase* download_controller_; | 104 static DownloadControllerBase* download_controller_; |
103 }; | 105 }; |
104 | 106 |
105 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ | 107 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ |
OLD | NEW |