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

Unified Diff: chrome/browser/dom_ui/fileicon_source.cc

Issue 40068: Show icons for exe files in download manager. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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/dom_ui/fileicon_source.cc
===================================================================
--- chrome/browser/dom_ui/fileicon_source.cc (revision 10778)
+++ chrome/browser/dom_ui/fileicon_source.cc (working copy)
@@ -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 @@
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 @@
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));
« 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