Home | History | Annotate | Download | only in android
      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.
      4 
      5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
      6 #define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
      7 
      8 #include "content/common/content_export.h"
      9 #include "content/public/common/context_menu_params.h"
     10 
     11 namespace content {
     12 class DownloadItem;
     13 class WebContents;
     14 
     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();
     21 
     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;
     26 
     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;
     31 
     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;
     36 
     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;
     40 
     41  protected:
     42   virtual ~DownloadControllerAndroid() {};
     43 };
     44 
     45 }  // namespace content
     46 
     47 #endif  // CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_
     48