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

Unified Diff: chrome/browser/extensions/platform_app_launcher.cc

Issue 14254002: Treat unknown MIME type as application/octet-stream when launching apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
Index: chrome/browser/extensions/platform_app_launcher.cc
diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc
index 2ad1d776afc7f36e46907c0d4df65efd9e71de8e..984b7e2a69c29f2734890947a708118afd5415cf 100644
--- a/chrome/browser/extensions/platform_app_launcher.cc
+++ b/chrome/browser/extensions/platform_app_launcher.cc
@@ -56,6 +56,8 @@ namespace extensions {
namespace {
+const char kFallbackMimeType[] = "application/octet-stream";
+
bool MakePathAbsolute(const base::FilePath& current_directory,
base::FilePath* file_path) {
DCHECK(file_path);
@@ -154,13 +156,8 @@ class PlatformAppPathLauncher
}
std::string mime_type;
- // If we cannot obtain the MIME type, launch with no launch data.
if (!net::GetMimeTypeFromFile(file_path_, &mime_type)) {
koz (OOO until 15th September) 2013/04/16 04:56:18 nit: curlies are unnecessary now
Sam McNally 2013/04/16 05:17:33 Done.
- LOG(WARNING) << "Could not obtain MIME type for "
- << file_path_.value();
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
- &PlatformAppPathLauncher::LaunchWithNoLaunchData, this));
- return;
+ mime_type.assign(kFallbackMimeType);
koz (OOO until 15th September) 2013/04/16 04:56:18 Is this different to mime_type = kFallbackMimeTyp
Sam McNally 2013/04/16 05:17:33 No. Changed to assignment as it's probably clearer
}
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
@@ -189,13 +186,16 @@ class PlatformAppPathLauncher
drive::DriveFileType file_type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (error != drive::DRIVE_FILE_OK || mime_type.empty() ||
- file_type != drive::REGULAR_FILE) {
+ if (error != drive::DRIVE_FILE_OK || file_type != drive::REGULAR_FILE) {
LaunchWithNoLaunchData();
return;
}
- LaunchWithMimeType(mime_type);
+ if (mime_type.empty()) {
koz (OOO until 15th September) 2013/04/16 04:56:18 nit: remove curlies
Sam McNally 2013/04/16 05:17:33 Done.
+ LaunchWithMimeType(kFallbackMimeType);
koz (OOO until 15th September) 2013/04/16 04:56:18 nit: I think LaunchWithMimeType(mime_type.empty()
Sam McNally 2013/04/16 05:17:33 Done.
+ } else {
+ LaunchWithMimeType(mime_type);
+ }
}
#endif // defined(OS_CHROMEOS)

Powered by Google App Engine
This is Rietveld 408576698