| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 import android.content.Context; | 7 import android.content.Context; |
| 8 | 8 |
| 9 import org.chromium.base.CalledByNative; | 9 import org.chromium.base.CalledByNative; |
| 10 import org.chromium.base.JNINamespace; | 10 import org.chromium.base.JNINamespace; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Notifies the download delegate of a new GET download and passes all the i
nformation | 62 * Notifies the download delegate of a new GET download and passes all the i
nformation |
| 63 * needed to download the file. | 63 * needed to download the file. |
| 64 * | 64 * |
| 65 * The download delegate is expected to handle the download. | 65 * The download delegate is expected to handle the download. |
| 66 */ | 66 */ |
| 67 @CalledByNative | 67 @CalledByNative |
| 68 public void newHttpGetDownload(ContentViewCore view, String url, | 68 public void newHttpGetDownload(ContentViewCore view, String url, |
| 69 String userAgent, String contentDisposition, String mimeType, | 69 String userAgent, String contentDisposition, String mimeType, |
| 70 String cookie, String referer, long contentLength) { | 70 String cookie, String referer, String filename, long contentLength)
{ |
| 71 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView(
view); | 71 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView(
view); |
| 72 | 72 |
| 73 if (downloadDelegate != null) { | 73 if (downloadDelegate != null) { |
| 74 DownloadInfo downloadInfo = new DownloadInfo.Builder() | 74 DownloadInfo downloadInfo = new DownloadInfo.Builder() |
| 75 .setUrl(url) | 75 .setUrl(url) |
| 76 .setUserAgent(userAgent) | 76 .setUserAgent(userAgent) |
| 77 .setContentDisposition(contentDisposition) | 77 .setContentDisposition(contentDisposition) |
| 78 .setMimeType(mimeType) | 78 .setMimeType(mimeType) |
| 79 .setCookie(cookie) | 79 .setCookie(cookie) |
| 80 .setReferer(referer) | 80 .setReferer(referer) |
| 81 .setFileName(filename) |
| 81 .setContentLength(contentLength) | 82 .setContentLength(contentLength) |
| 82 .setIsGETRequest(true) | 83 .setIsGETRequest(true) |
| 83 .build(); | 84 .build(); |
| 84 downloadDelegate.requestHttpGetDownload(downloadInfo); | 85 downloadDelegate.requestHttpGetDownload(downloadInfo); |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| 88 /** | 89 /** |
| 89 * Notifies the download delegate that a new download has started. This can | 90 * Notifies the download delegate that a new download has started. This can |
| 90 * be either a POST download or a GET download with authentication. | 91 * be either a POST download or a GET download with authentication. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 int downloadId) { | 159 int downloadId) { |
| 159 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView(
view); | 160 ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView(
view); |
| 160 if (downloadDelegate != null) { | 161 if (downloadDelegate != null) { |
| 161 downloadDelegate.onDangerousDownload(filename, downloadId); | 162 downloadDelegate.onDangerousDownload(filename, downloadId); |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 | 165 |
| 165 // native methods | 166 // native methods |
| 166 private native void nativeInit(); | 167 private native void nativeInit(); |
| 167 } | 168 } |
| OLD | NEW |