diff options
Diffstat (limited to 'google_apis/drive/gdata_wapi_parser.cc')
-rw-r--r-- | google_apis/drive/gdata_wapi_parser.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/google_apis/drive/gdata_wapi_parser.cc b/google_apis/drive/gdata_wapi_parser.cc index 1951c17..2f3c978 100644 --- a/google_apis/drive/gdata_wapi_parser.cc +++ b/google_apis/drive/gdata_wapi_parser.cc @@ -536,6 +536,17 @@ std::string ResourceEntry::GetHostedDocumentExtension() const { } // static +DriveEntryKind ResourceEntry::GetEntryKindFromExtension( + const std::string& extension) { + for (size_t i = 0; i < arraysize(kEntryKindMap); ++i) { + const char* document_extension = kEntryKindMap[i].extension; + if (document_extension && extension == document_extension) + return kEntryKindMap[i].kind; + } + return ENTRY_KIND_UNKNOWN; +} + +// static int ResourceEntry::ClassifyEntryKindByFileExtension( const base::FilePath& file_path) { #if defined(OS_WIN) @@ -543,12 +554,7 @@ int ResourceEntry::ClassifyEntryKindByFileExtension( #else std::string file_extension = file_path.Extension(); #endif - for (size_t i = 0; i < arraysize(kEntryKindMap); ++i) { - const char* document_extension = kEntryKindMap[i].extension; - if (document_extension && file_extension == document_extension) - return ClassifyEntryKind(kEntryKindMap[i].kind); - } - return 0; + return ClassifyEntryKind(GetEntryKindFromExtension(file_extension)); } // static |