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

Unified Diff: chrome/browser/ui/webui/chromeos/gdata_source.cc

Issue 9965069: MHTML loading fix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « no previous file | net/base/mime_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « no previous file | net/base/mime_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698