Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: chrome/browser/android/download/chrome_download_delegate.h

Issue 2371773003: Clean up Android DownloadManager code as most download now go through Chrome Network stack (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CHROME_DOWNLOAD_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_DELEGATE_H_
6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_DELEGATE_H_ 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_DELEGATE_H_
7 7
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "content/public/browser/web_contents_user_data.h" 9 #include "content/public/browser/web_contents_user_data.h"
10 10
11 class ChromeDownloadDelegate 11 class ChromeDownloadDelegate
12 : public content::WebContentsUserData<ChromeDownloadDelegate> { 12 : public content::WebContentsUserData<ChromeDownloadDelegate> {
13 public: 13 public:
14 // Returns true iff this request resulted in the tab creating the download 14 // Returns true iff this request resulted in the tab creating the download
15 // to close. 15 // to close.
16 static bool EnqueueDownloadManagerRequest(jobject chrome_download_delegate, 16 static bool EnqueueDownloadManagerRequest(jobject chrome_download_delegate,
17 bool overwrite, 17 bool overwrite,
18 jobject download_info); 18 jobject download_info);
19 19
20 void SetJavaRef(JNIEnv*, jobject obj); 20 void SetJavaRef(JNIEnv*, jobject obj);
21 21
22 void RequestHTTPGetDownload(const std::string& url, 22 void OnDownloadStarted(const std::string& filename);
23 const std::string& user_agent,
24 const std::string& content_disposition,
25 const std::string& mime_type,
26 const std::string& cookie,
27 const std::string& referer,
28 const base::string16& file_name,
29 int64_t content_length,
30 bool has_user_geature,
31 bool must_download);
32 void OnDownloadStarted(const std::string& filename,
33 const std::string& mime_type);
34 void OnDangerousDownload(const std::string& filename, 23 void OnDangerousDownload(const std::string& filename,
35 const std::string& guid); 24 const std::string& guid);
36 void RequestFileAccess(intptr_t callback_id); 25 void RequestFileAccess(intptr_t callback_id);
37 26
38 private: 27 private:
39 explicit ChromeDownloadDelegate(content::WebContents* contents); 28 explicit ChromeDownloadDelegate(content::WebContents* contents);
40 friend class content::WebContentsUserData<ChromeDownloadDelegate>; 29 friend class content::WebContentsUserData<ChromeDownloadDelegate>;
41 ~ChromeDownloadDelegate() override; 30 ~ChromeDownloadDelegate() override;
42 31
43 // A reference to the Java ChromeDownloadDelegate object. 32 // A reference to the Java ChromeDownloadDelegate object.
44 jobject java_ref_; 33 jobject java_ref_;
45 }; 34 };
46 35
47 bool RegisterChromeDownloadDelegate(JNIEnv* env); 36 bool RegisterChromeDownloadDelegate(JNIEnv* env);
48 37
49 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_DELEGATE_H_ 38 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698