Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 struct DownloadInfo { | 29 struct DownloadInfo { |
| 30 explicit DownloadInfo(const net::URLRequest* request); | 30 explicit DownloadInfo(const net::URLRequest* request); |
| 31 DownloadInfo(const DownloadInfo& other); | 31 DownloadInfo(const DownloadInfo& other); |
| 32 ~DownloadInfo(); | 32 ~DownloadInfo(); |
| 33 | 33 |
| 34 // The URL from which we are downloading. This is the final URL after any | 34 // The URL from which we are downloading. This is the final URL after any |
| 35 // redirection by the server for |original_url_|. | 35 // redirection by the server for |original_url_|. |
| 36 GURL url; | 36 GURL url; |
| 37 // The original URL before any redirection by the server for this URL. | 37 // The original URL before any redirection by the server for this URL. |
| 38 GURL original_url; | 38 GURL original_url; |
| 39 int64_t total_bytes; | |
| 40 std::string content_disposition; | 39 std::string content_disposition; |
| 41 std::string original_mime_type; | 40 std::string original_mime_type; |
| 42 std::string user_agent; | 41 std::string user_agent; |
| 43 std::string cookie; | 42 std::string cookie; |
| 44 std::string referer; | 43 std::string referer; |
| 45 bool has_user_gesture; | |
| 46 | |
| 47 content::WebContents* web_contents; | |
| 48 // Default copy constructor is used for passing this struct by value. | |
| 49 }; | 44 }; |
| 50 | 45 |
| 51 // Interface to request GET downloads and send notifications for POST | 46 // Interface to request GET downloads and send notifications for POST |
| 52 // downloads. | 47 // downloads. |
| 53 class DownloadControllerBase : public content::DownloadItem::Observer { | 48 class DownloadControllerBase : public content::DownloadItem::Observer { |
| 54 public: | 49 public: |
| 55 // Returns the singleton instance of the DownloadControllerBase. | 50 // Returns the singleton instance of the DownloadControllerBase. |
| 56 static DownloadControllerBase* Get(); | 51 static DownloadControllerBase* Get(); |
| 57 | 52 |
| 58 // Called to set the DownloadControllerBase instance. | 53 // Called to set the DownloadControllerBase instance. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 76 | 71 |
| 77 // Called to prompt the user for file access permission. When finished, | 72 // Called to prompt the user for file access permission. When finished, |
| 78 // |callback| will be executed. | 73 // |callback| will be executed. |
| 79 virtual void AcquireFileAccessPermission( | 74 virtual void AcquireFileAccessPermission( |
| 80 content::WebContents* web_contents, | 75 content::WebContents* web_contents, |
| 81 const AcquireFileAccessPermissionCallback& callback) = 0; | 76 const AcquireFileAccessPermissionCallback& callback) = 0; |
| 82 | 77 |
| 83 // Called by unit test to approve or disapprove file access request. | 78 // Called by unit test to approve or disapprove file access request. |
| 84 virtual void SetApproveFileAccessRequestForTesting(bool approve) {} | 79 virtual void SetApproveFileAccessRequestForTesting(bool approve) {} |
| 85 | 80 |
| 81 // Starts a new download request with Android DownloadManager. | |
| 82 virtual void CreateGETDownload( | |
|
David Trainor- moved to gerrit
2017/01/24 17:13:35
Who calls this?
qinmin
2017/01/24 17:32:24
InterceptDownloadResourceThrottle calls this to le
| |
| 83 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | |
| 84 const DownloadInfo& info) = 0; | |
| 85 | |
| 86 protected: | 86 protected: |
| 87 ~DownloadControllerBase() override {} | 87 ~DownloadControllerBase() override {} |
| 88 static DownloadControllerBase* download_controller_; | 88 static DownloadControllerBase* download_controller_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ | 91 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_BASE_H_ |
| OLD | NEW |