content_uri_utils.h 1.4 KB

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