OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_ANDROID_CONTENT_URI_UTILS_H_ |
| 6 #define NET_ANDROID_CONTENT_URI_UTILS_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/files/file_path.h" |
| 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/net_export.h" |
| 14 |
| 15 namespace base { |
| 16 class TaskRunner; |
| 17 } |
| 18 |
| 19 // Utility functions to handle content url on android. |
| 20 namespace net { |
| 21 |
| 22 bool RegisterContentUriUtils(JNIEnv* env); |
| 23 |
| 24 // Post a task on to the |task_runner| and retrieve the length of a content url |
| 25 // file. When finished, |callback| will be executed. |
| 26 // Returns net::ERR_IO_PENDING since the task runs asynchronously. |
| 27 NET_EXPORT int64 GetContentUrlLength( |
| 28 base::TaskRunner* task_runner, |
| 29 const base::FilePath& content_url, |
| 30 const net::Int64CompletionCallback& callback); |
| 31 |
| 32 // Get the length of a content url file synchronously. Returns -1 if the url |
| 33 // is invalid, or the actual file length otherwise. |
| 34 NET_EXPORT int64 GetContentUrlLengthSync(const base::FilePath& content_url); |
| 35 |
| 36 // Opens a content url for read and returns the file descriptor to the caller. |
| 37 // Returns -1 if the url is invalid. |
| 38 NET_EXPORT int OpenContentUrlForRead(const base::FilePath& content_url); |
| 39 |
| 40 } // namespace net |
| 41 |
| 42 #endif // NET_ANDROID_CONTENT_URI_UTILS_H_ |
OLD | NEW |