| Index: content/public/android/java/src/org/chromium/content/browser/DownloadController.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/DownloadController.java b/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
|
| index 81bca73b004c478ddaf79ec1297031f73688a8e7..5634f6f97c148754408b5d69fce006e02f33c0d3 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
|
| @@ -8,6 +8,7 @@ import android.content.Context;
|
|
|
| import org.chromium.base.CalledByNative;
|
| import org.chromium.base.JNINamespace;
|
| +import org.chromium.ui.base.WindowAndroid.FileAccessCallback;
|
|
|
| /**
|
| * Java counterpart of android DownloadController.
|
| @@ -162,6 +163,35 @@ public class DownloadController {
|
| }
|
| }
|
|
|
| + /**
|
| + * Returns whether file access is allowed.
|
| + *
|
| + * @param view The ContentViewCore to access file system.
|
| + * @return true if allowed, or false otherwise.
|
| + */
|
| + @CalledByNative
|
| + private boolean hasFileAccess(ContentViewCore view) {
|
| + return view.getWindowAndroid().hasFileAccess();
|
| + }
|
| +
|
| + /**
|
| + * Called to prompt user with the file access permission.
|
| + *
|
| + * @param view The ContentViewCore to access file system.
|
| + * @param callbackId The native callback function pointer.
|
| + */
|
| + @CalledByNative
|
| + private void requestFileAccess(ContentViewCore view, final long callbackId) {
|
| + FileAccessCallback callback = new FileAccessCallback() {
|
| + @Override
|
| + public void onFileAccessResult(boolean granted) {
|
| + nativeOnRequestFileAccessResult(callbackId, granted);
|
| + }
|
| + };
|
| + view.getWindowAndroid().requestFileAccess(callback);
|
| + }
|
| +
|
| // native methods
|
| private native void nativeInit();
|
| + private native void nativeOnRequestFileAccessResult(long callbackId, boolean granted);
|
| }
|
|
|