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

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

Issue 10559086: Fixing mime type so that MHTML files can be opened directly from Google Drive. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
index 271f8bc6d82f20301ef07eb294b8cdfb5ceb2c9a..8ded7b4fc5374dd7f8e28b022ebe77f3c22952de 100644
--- a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
+++ b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
@@ -323,9 +323,24 @@ void GDataURLRequestJob::Kill() {
weak_ptr_factory_->InvalidateWeakPtrs();
}
+const struct MimeTypeReplacement {
Greg Spencer (Chromium) 2012/06/20 16:44:56 Can you move this to the top of the file, under kI
tudalex(Chromium) 2012/06/20 18:20:30 Done.
+ const char* original_type;
+ const char* new_type;
Greg Spencer (Chromium) 2012/06/20 16:44:56 Can you please split this into a struct definition
tudalex(Chromium) 2012/06/20 18:20:30 Done.
+} kMimeTypeReplacements[] = {
+ {"message/rfc822","multipart/related"}
+};
+
+std::string FixupMimeType(const std::string& type) {
Greg Spencer (Chromium) 2012/06/20 16:44:56 Since this isn't a member of the class here, can y
tudalex(Chromium) 2012/06/20 18:20:30 Done.
+ for (size_t i = 0; i < arraysize(kMimeTypeReplacements); i++) {
+ if (type == kMimeTypeReplacements[i].original_type)
+ return kMimeTypeReplacements[i].new_type;
+ }
+ return type;
+}
+
bool GDataURLRequestJob::GetMimeType(std::string* mime_type) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- mime_type->assign(mime_type_);
+ mime_type->assign(FixupMimeType(mime_type_));
return !mime_type->empty();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698