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

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: moving support.v4 import from ui/ to chrome/ 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
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..3eb187cc6f9f93960ce08994183f79cd27b442b0 100644
--- a/base/android/java/src/org/chromium/base/ContentUriUtils.java
+++ b/base/android/java/src/org/chromium/base/ContentUriUtils.java
@@ -11,15 +11,46 @@ 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 {
+public class ContentUriUtils {
private static final String TAG = "ContentUriUtils";
+ private static final ContentUriUtils sInstance = new ContentUriUtils();
+ private FileProviderUtil mFileProviderUtil = null;
+
+ /**
+ * Class for providing functionalities to translate a file into content URI.
Yaron 2014/08/25 19:13:05 Provides functionality to translate a file into a
qinmin 2014/08/25 20:27:19 Done.
+ */
+ 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 ContentUriUtils getInstance() {
Yaron 2014/08/25 19:13:05 How is this related to FileProviderUtil? Why do we
qinmin 2014/08/25 20:27:19 Since FileProviderUtil implementation exits in chr
+ return sInstance;
+ }
+
+ public void setFileProviderUtil(FileProviderUtil util) {
+ mFileProviderUtil = util;
+ }
+
+ public Uri getContentUriFromFile(Context context, File file) {
+ if (mFileProviderUtil != null) {
Yaron 2014/08/25 19:13:05 Which threads do you anticipate being involved? If
qinmin 2014/08/25 20:27:19 This should be on the UI thread. On 2014/08/25 19
Yaron 2014/08/25 23:37:33 Then please add ThreadUtils.assertOnUiThread
qinmin 2014/08/26 00:24:03 Done.
+ return mFileProviderUtil.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') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698