| Index: google_apis/drive/gdata_wapi_parser.cc
|
| diff --git a/google_apis/drive/gdata_wapi_parser.cc b/google_apis/drive/gdata_wapi_parser.cc
|
| index 1951c177a5e904aa6bca86f0aea940a0f8337361..2f3c97847a16254864334acb6c384a7da9f0016b 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
|
|
|