| Index: chrome/browser/android/download/download_controller.h
|
| diff --git a/content/browser/android/download_controller_android_impl.h b/chrome/browser/android/download/download_controller.h
|
| similarity index 59%
|
| rename from content/browser/android/download_controller_android_impl.h
|
| rename to chrome/browser/android/download/download_controller.h
|
| index 133c1029092550e69e1e4686e69fefabc23a5eaf..25b43e80246a8206dcf752b55b2ed999ee449bed 100644
|
| --- a/content/browser/android/download_controller_android_impl.h
|
| +++ b/chrome/browser/android/download/download_controller.h
|
| @@ -10,26 +10,27 @@
|
| //
|
| // Call sequence
|
| // GET downloads:
|
| -// DownloadControllerAndroid::CreateGETDownload() =>
|
| +// DownloadController::CreateGETDownload() =>
|
| // DownloadController.newHttpGetDownload() =>
|
| // DownloadListener.onDownloadStart() /
|
| // DownloadListener2.requestHttpGetDownload()
|
| //
|
|
|
| -#ifndef CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_
|
| -#define CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_
|
| -
|
| -#include <string>
|
| +#ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_H_
|
| +#define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_H_
|
|
|
| #include <stdint.h>
|
|
|
| +#include <string>
|
| +
|
| #include "base/android/jni_weak_ref.h"
|
| #include "base/android/scoped_java_ref.h"
|
| #include "base/callback.h"
|
| #include "base/macros.h"
|
| #include "base/memory/scoped_vector.h"
|
| #include "base/memory/singleton.h"
|
| -#include "content/public/browser/android/download_controller_android.h"
|
| +#include "chrome/browser/android/download/download_controller_base.h"
|
| +#include "chrome/browser/ui/android/view_android_helper.h"
|
| #include "net/cookies/cookie_monster.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -37,36 +38,36 @@ namespace net {
|
| class URLRequest;
|
| }
|
|
|
| +namespace ui {
|
| +class WindowAndroid;
|
| +}
|
| +
|
| namespace content {
|
| -struct GlobalRequestID;
|
| -class DeferredDownloadObserver;
|
| class RenderViewHost;
|
| class WebContents;
|
| +}
|
|
|
| -class DownloadControllerAndroidImpl : public DownloadControllerAndroid {
|
| +class DownloadController : public DownloadControllerBase {
|
| public:
|
| - static DownloadControllerAndroidImpl* GetInstance();
|
| + static DownloadController* GetInstance();
|
|
|
| static bool RegisterDownloadController(JNIEnv* env);
|
|
|
| // Called when DownloadController Java object is instantiated.
|
| void Init(JNIEnv* env, jobject obj);
|
|
|
| - // Removes a deferred download from |deferred_downloads_|.
|
| - void CancelDeferredDownload(DeferredDownloadObserver* observer);
|
| -
|
| - // DownloadControllerAndroid implementation.
|
| + // DownloadControllerBase implementation.
|
| void AcquireFileAccessPermission(
|
| - WebContents* web_contents,
|
| + content::WebContents* web_contents,
|
| const AcquireFileAccessPermissionCallback& callback) override;
|
| void SetDefaultDownloadFileName(const std::string& file_name) override;
|
|
|
| private:
|
| // Used to store all the information about an Android download.
|
| - struct DownloadInfoAndroid {
|
| - explicit DownloadInfoAndroid(net::URLRequest* request);
|
| - DownloadInfoAndroid(const DownloadInfoAndroid& other);
|
| - ~DownloadInfoAndroid();
|
| + struct DownloadInfo {
|
| + explicit DownloadInfo(const net::URLRequest* request);
|
| + DownloadInfo(const DownloadInfo& other);
|
| + ~DownloadInfo();
|
|
|
| // The URL from which we are downloading. This is the final URL after any
|
| // redirection by the server for |original_url_|.
|
| @@ -81,66 +82,65 @@ class DownloadControllerAndroidImpl : public DownloadControllerAndroid {
|
| std::string referer;
|
| bool has_user_gesture;
|
|
|
| - WebContents* web_contents;
|
| + content::WebContents* web_contents;
|
| // Default copy constructor is used for passing this struct by value.
|
| };
|
| struct JavaObject;
|
| - friend struct base::DefaultSingletonTraits<DownloadControllerAndroidImpl>;
|
| - DownloadControllerAndroidImpl();
|
| - ~DownloadControllerAndroidImpl() override;
|
| + friend struct base::DefaultSingletonTraits<DownloadController>;
|
| + DownloadController();
|
| + ~DownloadController() override;
|
|
|
| // Helper method for implementing AcquireFileAccessPermission().
|
| - bool HasFileAccessPermission(
|
| - base::android::ScopedJavaLocalRef<jobject> j_content_view_core);
|
| + bool HasFileAccessPermission(ui::WindowAndroid* window_android);
|
|
|
| - // DownloadControllerAndroid implementation.
|
| + // DownloadControllerBase implementation.
|
| void CreateGETDownload(int render_process_id,
|
| int render_view_id,
|
| - int request_id,
|
| + const net::URLRequest* request,
|
| bool must_download) override;
|
| - void OnDownloadStarted(DownloadItem* download_item) override;
|
| - void StartContextMenuDownload(const ContextMenuParams& params,
|
| - WebContents* web_contents,
|
| + void OnDownloadStarted(content::DownloadItem* download_item) override;
|
| + void StartContextMenuDownload(const content::ContextMenuParams& params,
|
| + content::WebContents* web_contents,
|
| bool is_link,
|
| const std::string& extra_headers) override;
|
| - void DangerousDownloadValidated(WebContents* web_contents,
|
| + void DangerousDownloadValidated(content::WebContents* web_contents,
|
| const std::string& download_guid,
|
| bool accept) override;
|
|
|
| // DownloadItem::Observer interface.
|
| - void OnDownloadUpdated(DownloadItem* item) override;
|
| + void OnDownloadUpdated(content::DownloadItem* item) override;
|
|
|
| - typedef base::Callback<void(const DownloadInfoAndroid&)>
|
| + typedef base::Callback<void(const DownloadInfo&)>
|
| GetDownloadInfoCB;
|
| - void PrepareDownloadInfo(const GlobalRequestID& global_id,
|
| + void PrepareDownloadInfo(const net::URLRequest* request,
|
| const GetDownloadInfoCB& callback);
|
| - void CheckPolicyAndLoadCookies(const DownloadInfoAndroid& info,
|
| + void CheckPolicyAndLoadCookies(const DownloadInfo& info,
|
| const GetDownloadInfoCB& callback,
|
| - const GlobalRequestID& global_id,
|
| + const net::URLRequest* request,
|
| const net::CookieList& cookie_list);
|
| - void DoLoadCookies(const DownloadInfoAndroid& info,
|
| + void DoLoadCookies(const DownloadInfo& info,
|
| const GetDownloadInfoCB& callback,
|
| - const GlobalRequestID& global_id);
|
| - void OnCookieResponse(DownloadInfoAndroid info,
|
| + const net::URLRequest* request);
|
| + void OnCookieResponse(DownloadInfo info,
|
| const GetDownloadInfoCB& callback,
|
| const std::string& cookie);
|
| void StartDownloadOnUIThread(const GetDownloadInfoCB& callback,
|
| - const DownloadInfoAndroid& info);
|
| + const DownloadInfo& info);
|
| void StartAndroidDownload(int render_process_id,
|
| int render_view_id,
|
| bool must_download,
|
| - const DownloadInfoAndroid& info);
|
| + const DownloadInfo& info);
|
| void StartAndroidDownloadInternal(int render_process_id,
|
| int render_view_id,
|
| bool must_download,
|
| - const DownloadInfoAndroid& info,
|
| + const DownloadInfo& info,
|
| bool allowed);
|
|
|
| // The download item contains dangerous file types.
|
| - void OnDangerousDownload(DownloadItem *item);
|
| + void OnDangerousDownload(content::DownloadItem *item);
|
|
|
| base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents(
|
| - WebContents* web_contents);
|
| + content::WebContents* web_contents);
|
|
|
| // Creates Java object if it is not created already and returns it.
|
| JavaObject* GetJavaObject();
|
| @@ -149,11 +149,7 @@ class DownloadControllerAndroidImpl : public DownloadControllerAndroid {
|
|
|
| std::string default_file_name_;
|
|
|
| - ScopedVector<DeferredDownloadObserver> deferred_downloads_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(DownloadControllerAndroidImpl);
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadController);
|
| };
|
|
|
| -} // namespace content
|
| -
|
| -#endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_IMPL_H_
|
| +#endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_CONTROLLER_H_
|
|
|