summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/fileicon_source.cc
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 04:07:34 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 04:07:34 +0000
commit4343769b7971d1b794b729fcb82107101f1e306b (patch)
tree740a74f0a67a54aa55f41f938ebd1ab1cd35ca16 /chrome/browser/dom_ui/fileicon_source.cc
parent05ea0a37ff80d8dc71d795d5c08fb5dee0cd9bfb (diff)
downloadchromium_src-4343769b7971d1b794b729fcb82107101f1e306b.zip
chromium_src-4343769b7971d1b794b729fcb82107101f1e306b.tar.gz
chromium_src-4343769b7971d1b794b729fcb82107101f1e306b.tar.bz2
Show icons for exe files in download manager. Issue was that the paths were coming in with the wrong slash direction and escaping, which was OK for non-exes, but strangely bad for exes.
BUG=8327 Review URL: http://codereview.chromium.org/40068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/fileicon_source.cc')
-rw-r--r--chrome/browser/dom_ui/fileicon_source.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/dom_ui/fileicon_source.cc b/chrome/browser/dom_ui/fileicon_source.cc
index fd188c4..c2f75c4 100644
--- a/chrome/browser/dom_ui/fileicon_source.cc
+++ b/chrome/browser/dom_ui/fileicon_source.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/common/time_format.h"
#include "grit/generated_resources.h"
+#include "net/base/escape.h"
// The path used in internal URLs to file icon data.
static const char kFileIconPath[] = "fileicon";
@@ -24,8 +25,13 @@ void FileIconSource::StartDataRequest(const std::string& path,
int request_id) {
IconManager* im = g_browser_process->icon_manager();
+ // The path we receive has the wrong slashes and escaping for what we need;
+ // this only appears to matter for getting icons from .exe files.
+ std::string escaped_path = UnescapeURLComponent(path, UnescapeRule::SPACES);
+ std::replace(escaped_path.begin(), escaped_path.end(), '/', '\\');
+
// Fast look up.
- SkBitmap* icon = im->LookupIcon(UTF8ToWide(path), IconLoader::NORMAL);
+ SkBitmap* icon = im->LookupIcon(UTF8ToWide(escaped_path), IconLoader::NORMAL);
if (icon) {
std::vector<unsigned char> png_bytes;
@@ -35,7 +41,8 @@ void FileIconSource::StartDataRequest(const std::string& path,
SendResponse(request_id, icon_data);
} else {
// Icon was not in cache, go fetch it slowly.
- IconManager::Handle h = im->LoadIcon(UTF8ToWide(path), IconLoader::NORMAL,
+ IconManager::Handle h = im->LoadIcon(UTF8ToWide(escaped_path),
+ IconLoader::NORMAL,
&cancelable_consumer_,
NewCallback(this, &FileIconSource::OnFileIconDataAvailable));