Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / browser / android / download_controller_android.h
blob65da4b82f8f1e9c915f339ada0360872d9f4d1c2
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
8 #include "content/common/content_export.h"
9 #include "content/public/common/context_menu_params.h"
11 namespace content {
12 class DownloadItem;
13 class WebContents;
15 // Interface to request GET downloads and send notifications for POST
16 // downloads.
17 class CONTENT_EXPORT DownloadControllerAndroid {
18 public:
19 // Returns the singleton instance of the DownloadControllerAndroid.
20 static DownloadControllerAndroid* Get();
22 // Starts a new download request with Android. Should be called on the
23 // UI thread.
24 virtual void CreateGETDownload(int render_process_id, int render_view_id,
25 int request_id) = 0;
27 // Should be called when a download is started. It can be either a GET
28 // request with authentication or a POST request. Notifies the embedding
29 // app about the download. Should be called on the UI thread.
30 virtual void OnDownloadStarted(DownloadItem* download_item) = 0;
32 // Called when a download is initiated by context menu.
33 virtual void StartContextMenuDownload(
34 const ContextMenuParams& params, WebContents* web_contents,
35 bool is_link) = 0;
37 // Called when a dangerous download item is verified or rejected.
38 virtual void DangerousDownloadValidated(
39 WebContents* web_contents, int download_id, bool accept) = 0;
41 protected:
42 virtual ~DownloadControllerAndroid() {};
45 } // namespace content
47 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_