drivefs_util.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2019 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 ASH_COMPONENTS_DRIVEFS_DRIVEFS_UTIL_H_
  5. #define ASH_COMPONENTS_DRIVEFS_DRIVEFS_UTIL_H_
  6. #include "ash/components/drivefs/mojom/drivefs.mojom.h"
  7. namespace drivefs {
  8. // The type represents some sort of a file.
  9. inline bool IsAFile(mojom::FileMetadata::Type type) {
  10. return type == mojom::FileMetadata::Type::kHosted ||
  11. type == mojom::FileMetadata::Type::kFile;
  12. }
  13. // The type represents some sort of a directory.
  14. inline bool IsADirectory(mojom::FileMetadata::Type type) {
  15. return type == mojom::FileMetadata::Type::kDirectory;
  16. }
  17. // The type represents a virtual cloud-hosted object.
  18. inline bool IsHosted(mojom::FileMetadata::Type type) {
  19. return type == mojom::FileMetadata::Type::kHosted;
  20. }
  21. // The type represents a real local object.
  22. inline bool IsLocal(mojom::FileMetadata::Type type) {
  23. return type != mojom::FileMetadata::Type::kHosted;
  24. }
  25. } // namespace drivefs
  26. #endif // ASH_COMPONENTS_DRIVEFS_DRIVEFS_UTIL_H_