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

Unified Diff: ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java

Issue 46303005: Fix chrome upload with content uri (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 1 month 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 | « net/test/run_all_unittests.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
index f49576784d94f5d97e43ea89e2a0af2b67b09294..4e269b0ad070ca39928c4f2dbc653170b7627504 100644
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -165,27 +165,11 @@ class SelectFileDialog implements WindowAndroid.IntentCallback{
return;
}
- Cursor cursor = null;
- try {
- // We get back a content:// URI from the system if the user picked a file from the
- // gallery. The ContentView has functionality that will convert that content:// URI to
- // a file path on disk that Chromium understands.
- cursor = contentResolver.query(results.getData(),
- new String[] { MediaStore.MediaColumns.DATA }, null, null, null);
- if (cursor != null) {
- if (cursor.getCount() == 1) {
- cursor.moveToFirst();
- String path = cursor.getString(0);
- if (path != null) {
- // Not all providers support the MediaStore.DATA column. For example,
- // Gallery3D (com.android.gallery3d.provider) does not support it for
- // Picasa Web Album images.
- nativeOnFileSelected(mNativeSelectFileDialog, path);
- return;
- }
- }
- }
- } finally { if (cursor != null) { cursor.close(); } }
+ if (results.getScheme() != null
+ && results.getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
+ nativeOnFileSelected(mNativeSelectFileDialog, results.getData().toString());
+ return;
+ }
onFileNotSelected();
window.showError(R.string.opening_file_error);
« no previous file with comments | « net/test/run_all_unittests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698