Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: google_apis/drive/drive_entry_kinds.h

Issue 384543004: Get rid of DriveEntryKind. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698