ContentViewDownloadDelegate.java revision 5821806d5e7f356e8fa4b058a389a808ea183019
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
5package org.chromium.content.browser;
6
7/**
8 * Interface to be implemented by the embedder to handle file downloads.
9 */
10public interface ContentViewDownloadDelegate {
11    /**
12     * Notify the host application that a file should be downloaded. Replaces
13     * onDownloadStart from DownloadListener.
14     * @param url The full url to the content that should be downloaded
15     * @param userAgent the user agent to be used for the download.
16     * @param contentDisposition Content-disposition http header, if
17     *                           present.
18     * @param mimetype The mimetype of the content reported by the server.
19     * @param cookie The cookie
20     * @param referer Referer http header.
21     * @param contentLength The file size reported by the server.
22     */
23    void requestHttpGetDownload(String url, String userAgent, String contentDisposition,
24            String mimetype, String cookie, String referer, long contentLength);
25
26    /**
27     * Notify the host application that a POST download is started.
28     */
29    void onHttpPostDownloadStarted();
30
31    /**
32     * Notify the host application that a POST download is finished.
33     * @param url The full url to the content that was downloaded.
34     * @param mimetype The mimetype of downloaded file.
35     * @param path Path of the downloaded file.
36     * @param contentLength The file size of the downloaded file (in bytes).
37     * @param successful Whether the download succeeded
38     */
39    void onHttpPostDownloadCompleted(String url, String mimetype, String path,
40            long contentLength, boolean successful);
41}
42