Index: google_apis/drive/drive_entry_kinds.h |
diff --git a/google_apis/drive/drive_entry_kinds.h b/google_apis/drive/drive_entry_kinds.h |
index 27e0f69d046192ef13ea6dcd57454cf36032b079..2dc3b0481e4786fdcb70c08a4389fef17c8bcf18 100644 |
--- a/google_apis/drive/drive_entry_kinds.h |
+++ b/google_apis/drive/drive_entry_kinds.h |
@@ -5,6 +5,12 @@ |
#ifndef GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ |
#define GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ |
+#include <string> |
+ |
+namespace base { |
+class FilePath; |
+} // namespace base |
+ |
namespace google_apis { |
// DriveEntryKind specifies the kind of a Drive entry. |
@@ -35,6 +41,34 @@ enum DriveEntryKind { |
ENTRY_KIND_MAX_VALUE, |
}; |
+// Classes of EntryKind. Used for ClassifyEntryKind(). |
+enum DriveEntryKindClass { |
+ KIND_OF_NONE = 0, |
+ KIND_OF_HOSTED_DOCUMENT = 1, |
+ KIND_OF_GOOGLE_DOCUMENT = 1 << 1, |
+ KIND_OF_EXTERNAL_DOCUMENT = 1 << 2, |
+ KIND_OF_FOLDER = 1 << 3, |
+ KIND_OF_FILE = 1 << 4, |
+}; |
+ |
+// Returns preferred file extension for hosted documents. If entry is not |
+// a hosted document, this call returns an empty string. |
+std::string GetHostedDocumentExtension(DriveEntryKind kind); |
+ |
+// Returns the kind enum corresponding to the extension in form ".xxx". |
+DriveEntryKind GetEntryKindFromExtension(const std::string& extension); |
+ |
+// Classifies the EntryKind. The returned value is a bitmask of |
+// DriveEntryKindClass. For example, DOCUMENT is classified as |
+// KIND_OF_HOSTED_DOCUMENT and KIND_OF_GOOGLE_DOCUMENT, hence the returned |
+// value is KIND_OF_HOSTED_DOCUMENT | KIND_OF_GOOGLE_DOCUMENT. |
+int ClassifyEntryKind(DriveEntryKind kind); |
+ |
+// Classifies the EntryKind by the file extension of specific path. The |
+// returned value is a bitmask of DriveEntryKindClass. See also |
+// ClassifyEntryKind. |
+int ClassifyEntryKindByFileExtension(const base::FilePath& file); |
+ |
} // namespace google_apis |
#endif // GOOGLE_APIS_DRIVE_DRIVE_ENTRY_KINDS_H_ |