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

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

Issue 2014803002: Move DownloadControllerAndroid from content/ to chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved download delegate interface to native Created 4 years, 6 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 "base/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "content/public/browser/android/download_delegate.h"
11 12
12 class ChromeDownloadDelegate { 13 class ChromeDownloadDelegate : public content::DownloadDelegate {
13 public: 14 public:
14 // Returns true iff this request resulted in the tab creating the download 15 // Returns true iff this request resulted in the tab creating the download
15 // to close. 16 // to close.
16 static bool EnqueueDownloadManagerRequest(jobject chrome_download_delegate, 17 static bool EnqueueDownloadManagerRequest(jobject chrome_download_delegate,
17 bool overwrite, 18 bool overwrite,
18 jobject download_info); 19 jobject download_info);
20 ChromeDownloadDelegate(jobject obj);
21
22 // DownloadDelegate implementation
23 void NewHTTPGetDownload(const std::string& url,
24 const std::string& user_agent,
25 const std::string& content_disposition,
26 const std::string& mime_type,
27 const std::string& cookie,
28 const std::string& referer,
29 const base::string16& file_name,
30 int64_t content_length,
31 bool has_user_geature,
32 bool must_download) override;
33 void OnDownloadStarted(const std::string& filename,
34 const std::string& mime_type);
35 void OnDangerousDownload(const std::string& filename,
36 const std::string& guid);
37 void RequestFileAccess(intptr_t callback_id);
38
39 private:
40 base::android::ScopedJavaGlobalRef<jobject> obj_;
no sievers 2016/06/02 23:29:06 If the native instance holds a global ref, we have
Jinsuk Kim 2016/06/03 11:04:14 Replaced with weak reference to it so that ChromeD
19 }; 41 };
20 42
21 bool RegisterChromeDownloadDelegate(JNIEnv* env); 43 bool RegisterChromeDownloadDelegate(JNIEnv* env);
22 44
23 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_DELEGATE_H_ 45 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698