content_uri_utils.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 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. #ifndef BASE_ANDROID_CONTENT_URI_UTILS_H_
  5. #define BASE_ANDROID_CONTENT_URI_UTILS_H_
  6. #include <jni.h>
  7. #include "base/base_export.h"
  8. #include "base/files/file.h"
  9. #include "base/files/file_path.h"
  10. namespace base {
  11. // Opens a content URI for read and returns the file descriptor to the caller.
  12. // Returns -1 if the URI is invalid.
  13. BASE_EXPORT File OpenContentUriForRead(const FilePath& content_uri);
  14. // Check whether a content URI exists.
  15. BASE_EXPORT bool ContentUriExists(const FilePath& content_uri);
  16. // Gets MIME type from a content URI. Returns an empty string if the URI is
  17. // invalid.
  18. BASE_EXPORT std::string GetContentUriMimeType(const FilePath& content_uri);
  19. // Gets the display name from a content URI. Returns true if the name was found.
  20. BASE_EXPORT bool MaybeGetFileDisplayName(const FilePath& content_uri,
  21. base::string16* file_display_name);
  22. // Deletes a content URI.
  23. BASE_EXPORT bool DeleteContentUri(const FilePath& content_uri);
  24. // Gets content URI's file path (eg: "content://org.chromium...") from normal
  25. // file path (eg: "/data/user/0/...").
  26. BASE_EXPORT FilePath GetContentUriFromFilePath(const FilePath& file_path);
  27. } // namespace base
  28. #endif // BASE_ANDROID_CONTENT_URI_UTILS_H_