OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 /** | 7 /** |
8 * Interface to be implemented by the embedder to handle file downloads. | 8 * Interface to be implemented by the embedder to handle file downloads. |
9 */ | 9 */ |
10 public interface ContentViewDownloadDelegate { | 10 public interface ContentViewDownloadDelegate { |
11 /** | 11 /** |
12 * Notify the host application that a file should be downloaded. Replaces | 12 * Notify the host application that a file should be downloaded. Replaces |
13 * onDownloadStart from DownloadListener. | 13 * onDownloadStart from DownloadListener. |
14 * @param url The full url to the content that should be downloaded | 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. | 15 * @param userAgent the user agent to be used for the download. |
16 * @param contentDisposition Content-disposition http header, if | 16 * @param contentDisposition Content-disposition http header, if |
17 * present. | 17 * present. |
18 * @param mimetype The mimetype of the content reported by the server. | 18 * @param mimetype The mimetype of the content reported by the server. |
19 * @param cookie The cookie | 19 * @param cookie The cookie |
20 * @param referer Referer http header. | 20 * @param referer Referer http header. |
21 * @param contentLength The file size reported by the server. | 21 * @param contentLength The file size reported by the server. |
22 */ | 22 */ |
23 void requestHttpGetDownload(String url, String userAgent, String contentDisp
osition, | 23 void requestHttpGetDownload(String url, String userAgent, String contentDisp
osition, |
24 String mimetype, String cookie, String referer, long contentLength); | 24 String mimetype, String cookie, String referer, long contentLength); |
25 | 25 |
26 /** | 26 /** |
27 * Notify the host application that a download is started. | 27 * Notify the host application that a download is started. |
| 28 * @param filename File name of the downloaded file. |
| 29 * @param mimeType Mime of the downloaded item. |
28 */ | 30 */ |
29 void onDownloadStarted(); | 31 void onDownloadStarted(String filename, String mimeType); |
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 | 32 |
42 /** | 33 /** |
43 * Notify the host application that a download has an extension indicating | 34 * Notify the host application that a download has an extension indicating |
44 * a dangerous file type. | 35 * a dangerous file type. |
45 * @param filename File name of the downloaded file. | 36 * @param filename File name of the downloaded file. |
46 * @param downloadId The download id. | 37 * @param downloadId The download id. |
47 */ | 38 */ |
48 void onDangerousDownload(String filename, int downloadId); | 39 void onDangerousDownload(String filename, int downloadId); |
49 } | 40 } |
OLD | NEW |