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..8809e98529f84a71699145ed373720feac0f9fbe |
--- /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 "net/base/completion_callback.h" |
+#include "net/base/net_export.h" |
+#include "url/gurl.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 GURL& 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 GURL& 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 GURL& content_url); |
+ |
+} // namespace net |
+ |
+#endif // NET_ANDROID_CONTENT_URI_UTILS_H_ |