| Index: base/android/java/src/org/chromium/base/ContentUriUtils.java
|
| diff --git a/base/android/java/src/org/chromium/base/ContentUriUtils.java b/base/android/java/src/org/chromium/base/ContentUriUtils.java
|
| index b806b47d4e877a898c04cb683617f01c75c04662..70c27ed14167f8dc36774878e0f3b8df2058132c 100644
|
| --- a/base/android/java/src/org/chromium/base/ContentUriUtils.java
|
| +++ b/base/android/java/src/org/chromium/base/ContentUriUtils.java
|
| @@ -11,15 +11,43 @@ import android.net.Uri;
|
| import android.os.ParcelFileDescriptor;
|
| import android.util.Log;
|
|
|
| +import java.io.File;
|
| +
|
| /**
|
| * This class provides methods to access content URI schemes.
|
| */
|
| public abstract class ContentUriUtils {
|
| private static final String TAG = "ContentUriUtils";
|
| + private static FileProviderUtil sFileProviderUtil;
|
| +
|
| + /**
|
| + * Provides functionality to translate a file into a content URI for use
|
| + * with a content provider.
|
| + */
|
| + public interface FileProviderUtil {
|
| + /**
|
| + * Generate a content uri from the given file.
|
| + * @param context Application context.
|
| + * @param file The file to be translated.
|
| + */
|
| + public Uri getContentUriFromFile(Context context, File file);
|
| + }
|
|
|
| // Prevent instantiation.
|
| private ContentUriUtils() {}
|
|
|
| + public static void setFileProviderUtil(FileProviderUtil util) {
|
| + sFileProviderUtil = util;
|
| + }
|
| +
|
| + public static Uri getContentUriFromFile(Context context, File file) {
|
| + ThreadUtils.assertOnUiThread();
|
| + if (sFileProviderUtil != null) {
|
| + return sFileProviderUtil.getContentUriFromFile(context, file);
|
| + }
|
| + return null;
|
| + }
|
| +
|
| /**
|
| * Opens the content URI for reading, and returns the file descriptor to
|
| * the caller. The caller is responsible for closing the file desciptor.
|
|
|