1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.browser; 18 19 import android.webkit.DownloadListener; 20 21 /** 22 * An abstract download listener that allows passing extra information as 23 * part of onDownloadStart callback. 24 */ 25 public abstract class BrowserDownloadListener implements DownloadListener { 26 27 /** 28 * Notify the host application that a file should be downloaded 29 * @param url The full url to the content that should be downloaded 30 * @param userAgent the user agent to be used for the download. 31 * @param contentDisposition Content-disposition http header, if 32 * present. 33 * @param mimetype The mimetype of the content reported by the server 34 * @param referer The referer associated with this url 35 * @param contentLength The file size reported by the server 36 */ onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, String referer, long contentLength)37 public abstract void onDownloadStart(String url, String userAgent, 38 String contentDisposition, String mimetype, String referer, 39 long contentLength); 40 41 42 /** 43 * Notify the host application that a file should be downloaded 44 * @param url The full url to the content that should be downloaded 45 * @param userAgent the user agent to be used for the download. 46 * @param contentDisposition Content-disposition http header, if 47 * present. 48 * @param mimetype The mimetype of the content reported by the server 49 * @param contentLength The file size reported by the server 50 */ 51 @Override onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength)52 public void onDownloadStart(String url, String userAgent, 53 String contentDisposition, String mimetype, long contentLength) { 54 55 onDownloadStart(url, userAgent, contentDisposition, mimetype, null, 56 contentLength); 57 } 58 } 59