OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.chrome.browser.download; | 5 package org.chromium.chrome.browser.download; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.net.Uri; | 9 import android.net.Uri; |
10 import android.os.AsyncTask; | 10 import android.os.AsyncTask; |
11 import android.os.Environment; | 11 import android.os.Environment; |
12 import android.text.TextUtils; | 12 import android.text.TextUtils; |
13 import android.util.Log; | 13 import android.util.Log; |
14 import android.webkit.MimeTypeMap; | 14 import android.webkit.MimeTypeMap; |
15 import android.webkit.URLUtil; | 15 import android.webkit.URLUtil; |
16 import android.widget.Toast; | |
17 | 16 |
18 import org.chromium.base.VisibleForTesting; | 17 import org.chromium.base.VisibleForTesting; |
19 import org.chromium.base.annotations.CalledByNative; | 18 import org.chromium.base.annotations.CalledByNative; |
20 import org.chromium.chrome.R; | 19 import org.chromium.chrome.R; |
21 import org.chromium.chrome.browser.infobar.ConfirmInfoBar; | 20 import org.chromium.chrome.browser.infobar.ConfirmInfoBar; |
22 import org.chromium.chrome.browser.infobar.InfoBar; | 21 import org.chromium.chrome.browser.infobar.InfoBar; |
23 import org.chromium.chrome.browser.infobar.InfoBarListeners; | 22 import org.chromium.chrome.browser.infobar.InfoBarListeners; |
24 import org.chromium.chrome.browser.tab.Tab; | 23 import org.chromium.chrome.browser.tab.Tab; |
25 import org.chromium.chrome.browser.tabmodel.TabModelSelector; | 24 import org.chromium.chrome.browser.tabmodel.TabModelSelector; |
26 import org.chromium.content.browser.ContentViewDownloadDelegate; | 25 import org.chromium.content.browser.ContentViewDownloadDelegate; |
27 import org.chromium.content.browser.DownloadInfo; | 26 import org.chromium.content.browser.DownloadInfo; |
28 import org.chromium.content_public.browser.WebContents; | 27 import org.chromium.content_public.browser.WebContents; |
| 28 import org.chromium.ui.widget.Toast; |
29 | 29 |
30 import java.io.File; | 30 import java.io.File; |
31 | 31 |
32 /** | 32 /** |
33 * Chrome implementation of the ContentViewDownloadDelegate interface. | 33 * Chrome implementation of the ContentViewDownloadDelegate interface. |
34 * | 34 * |
35 * Listens to POST and GET download events. GET download requests are passed alo
ng to the | 35 * Listens to POST and GET download events. GET download requests are passed alo
ng to the |
36 * Android Download Manager. POST downloads are expected to be handled natively
and listener | 36 * Android Download Manager. POST downloads are expected to be handled natively
and listener |
37 * is responsible for adding the completed download to the download manager. | 37 * is responsible for adding the completed download to the download manager. |
38 * | 38 * |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 512 } |
513 | 513 |
514 private static native String nativeGetDownloadWarningText(String filename); | 514 private static native String nativeGetDownloadWarningText(String filename); |
515 private static native boolean nativeIsDownloadDangerous(String filename); | 515 private static native boolean nativeIsDownloadDangerous(String filename); |
516 private static native void nativeDangerousDownloadValidated( | 516 private static native void nativeDangerousDownloadValidated( |
517 Object tab, int downloadId, boolean accept); | 517 Object tab, int downloadId, boolean accept); |
518 private static native void nativeLaunchDownloadOverwriteInfoBar(ChromeDownlo
adDelegate delegate, | 518 private static native void nativeLaunchDownloadOverwriteInfoBar(ChromeDownlo
adDelegate delegate, |
519 Tab tab, DownloadInfo downloadInfo, String fileName, String dirName, | 519 Tab tab, DownloadInfo downloadInfo, String fileName, String dirName, |
520 String dirFullPath); | 520 String dirFullPath); |
521 } | 521 } |
OLD | NEW |