Index: chrome/browser/ui/webui/chromeos/gdata_source.cc |
diff --git a/chrome/browser/ui/webui/chromeos/gdata_source.cc b/chrome/browser/ui/webui/chromeos/gdata_source.cc |
index 3af3fc9cd787608b8df8b13ea1f2857d6791aab5..59a90b3f1c12071a70b2e96f307166a343929ab6 100644 |
--- a/chrome/browser/ui/webui/chromeos/gdata_source.cc |
+++ b/chrome/browser/ui/webui/chromeos/gdata_source.cc |
@@ -7,6 +7,7 @@ |
#include <string> |
#include <vector> |
+#include "base/basictypes.h" |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
#include "base/file_util.h" |
@@ -33,6 +34,13 @@ const net::UnescapeRule::Type kUrlPathUnescapeMask = |
net::UnescapeRule::URL_SPECIAL_CHARS | |
net::UnescapeRule::CONTROL_CHARS; |
+const struct MimeTypeReplacement { |
+ const char* original_type; |
+ const char* new_type; |
+} kMimeTypeReplacements[] = { |
+ {"message/rfc822", "multipart/related"} |
+}; |
+ |
// Helper function that reads file size. |
void GetFileSizeOnIOThreadPool(const FilePath& file_path, |
int64* file_size) { |
@@ -40,6 +48,14 @@ void GetFileSizeOnIOThreadPool(const FilePath& file_path, |
*file_size = 0; |
} |
+std::string FixupMimeType(const std::string& type) { |
+ for (size_t i = 0; i < arraysize(kMimeTypeReplacements); i++) { |
+ if (type == kMimeTypeReplacements[i].original_type) |
+ return kMimeTypeReplacements[i].new_type; |
+ } |
+ return type; |
+} |
+ |
bool ParseGDataUrlPath(const std::string& path, |
std::string* resource_id, |
std::string* file_name) { |
@@ -158,11 +174,11 @@ std::string GDataSource::GetMimeType(const std::string& path) const { |
GetFileMimeTypeDelegate delegate; |
system_service_->file_system()->FindFileByResourceIdSync(resource_id, |
- &delegate); |
+ &delegate); |
if (delegate.mime_type().empty()) |
return kMimeTypeOctetStream; |
- return delegate.mime_type(); |
+ return FixupMimeType(delegate.mime_type()); |
} |