diff options
author | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-16 14:04:16 +0000 |
---|---|---|
committer | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-16 14:04:16 +0000 |
commit | b63997e81c9023f103dd2cbcc6bac7dafbfa44da (patch) | |
tree | 73857ac8c1a21628312e90aade69e1a1deb393eb /apps | |
parent | 0b1b18c97ce0e70c12f5702469a823b3362b96f6 (diff) | |
download | chromium_src-b63997e81c9023f103dd2cbcc6bac7dafbfa44da.zip chromium_src-b63997e81c9023f103dd2cbcc6bac7dafbfa44da.tar.gz chromium_src-b63997e81c9023f103dd2cbcc6bac7dafbfa44da.tar.bz2 |
Revert 264167 "Sniff MIME type for files which have unknown exte..."
This revert is requested by fukino, who is the author of the patch.
This patch breaks a browser test on Windows.
> Sniff MIME type for files which have unknown extensions.
>
> What I want to do:
> Open text files which have unknown extensions(e.g. access.log.1) using packaged apps which can handle 'text/plain'(e.g. Text, Caret,...).
>
> Current situation:
> By following reasons, text files with unknow extension can't be opened.
> 1. FileManager guess the MIME type as empty, so 'text/plain'-supporting apps are not shown as handlers.
> 2. PlatformAppLauncher guess the MIME type as 'application/octet-stream', and it launch apps with no data because those apps don't handle 'application/octet-stream'.
>
> What I changed:
> Modified FileManager and PlatformAppLauncher to sniff MIME types if they are unknown based on extensions.
>
> BUG=352250
> R=benwells@chromium.org, hashimoto@chromium.org, jorgelo@chromium.org
>
> Review URL: https://codereview.chromium.org/224883008
>
> Patch from Naoki Fukino <fukino@chromium.org>.
TBR=yoshiki@chromium.org
Review URL: https://codereview.chromium.org/240313002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r-- | apps/launcher.cc | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/apps/launcher.cc b/apps/launcher.cc index 8d31a01..ba7c829 100644 --- a/apps/launcher.cc +++ b/apps/launcher.cc @@ -29,8 +29,6 @@ #include "extensions/common/extension.h" #include "extensions/common/extension_messages.h" #include "extensions/common/manifest_handlers/kiosk_mode_info.h" -#include "net/base/filename_util.h" -#include "net/base/mime_sniffer.h" #include "net/base/mime_util.h" #include "net/base/net_util.h" #include "url/gurl.h" @@ -183,21 +181,8 @@ class PlatformAppPathLauncher } std::string mime_type; - if (!net::GetMimeTypeFromFile(file_path_, &mime_type)) { - // If MIME type of the file can't be determined by its path, - // try to sniff it by its content. - std::vector<char> content(net::kMaxBytesToSniff); - int bytes_read = base::ReadFile(file_path_, &content[0], content.size()); - if (bytes_read >= 0) { - net::SniffMimeType(&content[0], - bytes_read, - net::FilePathToFileURL(file_path_), - std::string(), // type_hint (passes no hint) - &mime_type); - } - if (mime_type.empty()) - mime_type = kFallbackMimeType; - } + if (!net::GetMimeTypeFromFile(file_path_, &mime_type)) + mime_type = kFallbackMimeType; BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( &PlatformAppPathLauncher::LaunchWithMimeType, this, mime_type)); |