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

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

Issue 655303002: Fix an issue that some earlier android versions cannot handle file URI correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | 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 4f967b77c4ba6c03e034c972e6b316c8c264aa36..bc6efb78f9c1f90a86a3ecbbb21da1bf77d75635 100644
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -202,9 +202,13 @@ class SelectFileDialog implements WindowAndroid.IntentCallback {
if (results == null) {
// If we have a successful return but no data, then assume this is the camera returning
// the photo that we requested.
- nativeOnFileSelected(mNativeSelectFileDialog, mCameraOutputUri.toString(),
+ // If the uri is a file, we need to convert it to the absolute path or otherwise
+ // android cannot handle it correctly on some earlier versions.
+ // http://crbug.com/423338.
+ String path = ContentResolver.SCHEME_FILE.equals(mCameraOutputUri.getScheme()) ?
+ mCameraOutputUri.getPath() : mCameraOutputUri.toString();
+ nativeOnFileSelected(mNativeSelectFileDialog, path,
mCameraOutputUri.getLastPathSegment());
-
// Broadcast to the media scanner that there's a new photo on the device so it will
// show up right away in the gallery (rather than waiting until the next time the media
// scanner runs).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698