Skip to content

Commit

Permalink
Add interface for requesting file access
Browse files Browse the repository at this point in the history
This is needed for some features like download and local file access.

BUG=501606

Review URL: https://codereview.chromium.org/1219213002

Cr-Commit-Position: refs/heads/master@{#337110}
  • Loading branch information
qinmin authored and Commit bot committed Jul 1, 2015
1 parent 6181f27 commit ca6dce9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.util.Log;
import android.util.SparseArray;
Expand Down Expand Up @@ -255,6 +256,26 @@ public void requestPermissions(String[] permissions, PermissionCallback callback
assert false : "Failed to request permissions using a WindowAndroid without an Activity";
}

/**
* Determine whether access to file is granted.
*/
public boolean hasFileAccess() {
return true;
}

/**
* Requests the access to files.
* @param callback The callback to be notified whether access were granted.
*/
public void requestFileAccess(final FileAccessCallback callback) {
new Handler().post(new Runnable() {
@Override
public void run() {
callback.onFileAccessResult(false);
}
});
}

/**
* Displays an error message with a provided error message string.
* @param error The error message string to be displayed.
Expand Down Expand Up @@ -379,6 +400,17 @@ public interface PermissionCallback {
void onRequestPermissionsResult(String[] permissions, int[] grantResults);
}

/**
* Callback for file access requests.
*/
public interface FileAccessCallback {
/**
* Called upon completing a file access request.
* @param granted Whether file access is granted.
*/
void onFileAccessResult(boolean granted);
}

/**
* Tests that an activity is available to handle the passed in intent.
* @param intent The intent to check.
Expand Down

0 comments on commit ca6dce9

Please sign in to comment.