Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(961)

Unified Diff: base/android/java/src/org/chromium/base/ContentUriUtils.java

Issue 489053003: Use content URI to upload photos taken by camera (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add thread check Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/FileProviderHelper.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/FileProviderHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698