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

Unified Diff: webkit/browser/blob/local_file_stream_reader.cc

Issue 46303005: Fix chrome upload with content uri (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simplify the change using FILE enum instead of adding a new enum Created 7 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
Index: webkit/browser/blob/local_file_stream_reader.cc
diff --git a/webkit/browser/blob/local_file_stream_reader.cc b/webkit/browser/blob/local_file_stream_reader.cc
index 0686821ac2448a963e0ad106f97648386031fbb2..45a06368739d3dfc4d0ebe0dfcf483656dbb1e07 100644
--- a/webkit/browser/blob/local_file_stream_reader.cc
+++ b/webkit/browser/blob/local_file_stream_reader.cc
@@ -14,6 +14,10 @@
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
+#if defined(OS_ANDROID)
+#include "net/android/content_uri_utils.h"
+#endif
+
namespace webkit_blob {
namespace {
@@ -56,6 +60,17 @@ int LocalFileStreamReader::Read(net::IOBuffer* buf, int buf_len,
int64 LocalFileStreamReader::GetLength(
const net::Int64CompletionCallback& callback) {
+#if defined(OS_ANDROID)
+ if (file_path_.IsContentUrl()) {
+ net::GetContentUrlLength(
+ task_runner_.get(),
+ file_path_,
+ base::Bind(&LocalFileStreamReader::DidGetContentUrlLength,
+ weak_factory_.GetWeakPtr(),
+ callback));
+ return net::ERR_IO_PENDING;
+ }
+#endif
joth 2013/10/31 06:42:39 ...again if file_util::GetFileInfo() knew how to d
qinmin 2013/11/05 01:41:31 Done.
const bool posted = base::FileUtilProxy::GetFileInfo(
task_runner_.get(),
file_path_,
@@ -175,4 +190,16 @@ void LocalFileStreamReader::DidGetFileInfoForGetLength(
callback.Run(file_info.size);
}
+#if defined(OS_ANDROID)
+void LocalFileStreamReader::DidGetContentUrlLength(
+ const net::Int64CompletionCallback& callback,
+ int64 result) {
+ if (result < 0) {
+ callback.Run(net::ERR_FILE_NOT_FOUND);
+ return;
+ }
+ callback.Run(result);
+}
+#endif
+
} // namespace webkit_blob
« net/base/upload_file_element_reader.cc ('K') | « webkit/browser/blob/local_file_stream_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698