ContentViewDownloadDelegate.java revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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 download is started. 28 */ 29 void onDownloadStarted(); 30 31 /** 32 * Notify the host application that a 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 onDownloadCompleted(String url, String mimetype, String path, 40 long contentLength, boolean successful); 41 42 /** 43 * Notify the host application that a download has an extension indicating 44 * a dangerous file type. 45 * @param filename File name of the downloaded file. 46 * @param downloadId The download id. 47 */ 48 void onDangerousDownload(String filename, int downloadId); 49} 50