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

Unified Diff: chrome/browser/chromeos/gdata/drive_api_parser.cc

Issue 10828277: Get EntryKind from parsed FileResource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/browser/chromeos/gdata/drive_api_parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/drive_api_parser.cc
diff --git a/chrome/browser/chromeos/gdata/drive_api_parser.cc b/chrome/browser/chromeos/gdata/drive_api_parser.cc
index aef6deec20736986b4c37d04f8d83447655d5bc3..52363b5c5854a0cbd0e68f9fa7c72f619ffb2164 100644
--- a/chrome/browser/chromeos/gdata/drive_api_parser.cc
+++ b/chrome/browser/chromeos/gdata/drive_api_parser.cc
@@ -118,6 +118,18 @@ const char kFile[] = "file";
// https://developers.google.com/drive/v2/reference/changes/list
const char kChangeListKind[] = "drive#changeList";
+// Google Apps MIME types:
+const char kGoogleDocumentMimeType[] = "application/vnd.google-apps.document";
+const char kGoogleDrawingMimeType[] = "application/vnd.google-apps.drawing";
+const char kGoogleFormMimeType[] = "application/vnd.google-apps.form";
+const char kGooglePresentationMimeType[] =
+ "application/vnd.google-apps.presentation";
+const char kGoogleScriptMimeType[] = "application/vnd.google-apps.script";
+const char kGoogleSiteMimeType[] = "application/vnd.google-apps.site";
+const char kGoogleSpreadsheetMimeType[] =
+ "application/vnd.google-apps.spreadsheet";
+const char kGoogleTableMimeType[] = "application/vnd.google-apps.table";
+
// Maps category name to enum IconCategory.
struct AppIconCategoryMap {
gdata::DriveAppIcon::IconCategory category;
@@ -430,6 +442,24 @@ bool FileResource::IsDirectory() const {
return mime_type_ == kDriveFolderMimeType;
}
+DocumentEntry::EntryKind FileResource::GetKind() const {
+ if (mime_type() == kGoogleDocumentMimeType)
+ return DocumentEntry::DOCUMENT;
+ if (mime_type() == kGoogleSpreadsheetMimeType)
+ return DocumentEntry::SPREADSHEET;
+ if (mime_type() == kGooglePresentationMimeType)
+ return DocumentEntry::PRESENTATION;
+ if (mime_type() == kGoogleDrawingMimeType)
+ return DocumentEntry::DRAWING;
+ if (mime_type() == kGoogleTableMimeType)
+ return DocumentEntry::TABLE;
+ if (mime_type() == kDriveFolderMimeType)
+ return DocumentEntry::FOLDER;
+ if (mime_type() == "application/pdf")
+ return DocumentEntry::PDF;
+ return DocumentEntry::FILE;
+}
+
bool FileResource::Parse(const base::Value& value) {
base::JSONValueConverter<FileResource> converter;
if (!converter.Convert(value, this)) {
« no previous file with comments | « chrome/browser/chromeos/gdata/drive_api_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698