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

Unified Diff: net/android/content_uri_utils.h

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: net/android/content_uri_utils.h
diff --git a/net/android/content_uri_utils.h b/net/android/content_uri_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..4b0a5db76ed6d00acb33a9e3477cd4ca5b1f03bb
--- /dev/null
+++ b/net/android/content_uri_utils.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_ANDROID_CONTENT_URI_UTILS_H_
+#define NET_ANDROID_CONTENT_URI_UTILS_H_
+
+#include <jni.h>
+
+#include "base/basictypes.h"
+#include "base/files/file_path.h"
+#include "net/base/completion_callback.h"
+#include "net/base/net_export.h"
+
+namespace base {
+class TaskRunner;
+}
+
+// Utility functions to handle content url on android.
+namespace net {
+
+bool RegisterContentUriUtils(JNIEnv* env);
+
+// Post a task on to the |task_runner| and retrieve the length of a content url
+// file. When finished, |callback| will be executed.
+// Returns net::ERR_IO_PENDING since the task runs asynchronously.
+NET_EXPORT int64 GetContentUrlLength(
+ base::TaskRunner* task_runner,
+ const base::FilePath& content_url,
+ const net::Int64CompletionCallback& callback);
+
+// Get the length of a content url file synchronously. Returns -1 if the url
+// is invalid, or the actual file length otherwise.
+NET_EXPORT int64 GetContentUrlLengthSync(const base::FilePath& content_url);
+
+// Opens a content url for read and returns the file descriptor to the caller.
+// Returns -1 if the url is invalid.
+NET_EXPORT int OpenContentUrlForRead(const base::FilePath& content_url);
+
+} // namespace net
+
+#endif // NET_ANDROID_CONTENT_URI_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698