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

Side by Side Diff: chrome/browser/ui/webui/fileicon_source.cc

Issue 8552002: net: Move UnescapeRule into the net namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/fileicon_source.h" 5 #include "chrome/browser/ui/webui/fileicon_source.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 12 matching lines...) Expand all
23 : DataSource(kFileIconPath, MessageLoop::current()) {} 23 : DataSource(kFileIconPath, MessageLoop::current()) {}
24 24
25 FileIconSource::~FileIconSource() { 25 FileIconSource::~FileIconSource() {
26 cancelable_consumer_.CancelAllRequests(); 26 cancelable_consumer_.CancelAllRequests();
27 } 27 }
28 28
29 void FileIconSource::StartDataRequest(const std::string& path, 29 void FileIconSource::StartDataRequest(const std::string& path,
30 bool is_incognito, 30 bool is_incognito,
31 int request_id) { 31 int request_id) {
32 std::string escaped_path = net::UnescapeURLComponent(path, 32 std::string escaped_path = net::UnescapeURLComponent(path,
33 UnescapeRule::SPACES); 33 net::UnescapeRule::SPACES);
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 // The path we receive has the wrong slashes and escaping for what we need; 35 // The path we receive has the wrong slashes and escaping for what we need;
36 // this only appears to matter for getting icons from .exe files. 36 // this only appears to matter for getting icons from .exe files.
37 std::replace(escaped_path.begin(), escaped_path.end(), '/', '\\'); 37 std::replace(escaped_path.begin(), escaped_path.end(), '/', '\\');
38 FilePath escaped_filepath(UTF8ToWide(escaped_path)); 38 FilePath escaped_filepath(UTF8ToWide(escaped_path));
39 #elif defined(OS_POSIX) 39 #elif defined(OS_POSIX)
40 // The correct encoding on Linux may not actually be UTF8. 40 // The correct encoding on Linux may not actually be UTF8.
41 FilePath escaped_filepath(escaped_path); 41 FilePath escaped_filepath(escaped_path);
42 #endif 42 #endif
43 43
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (icon) { 75 if (icon) {
76 scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes); 76 scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes);
77 gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data()); 77 gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data());
78 78
79 SendResponse(request_id, icon_data); 79 SendResponse(request_id, icon_data);
80 } else { 80 } else {
81 // TODO(glen): send a dummy icon. 81 // TODO(glen): send a dummy icon.
82 SendResponse(request_id, NULL); 82 SendResponse(request_id, NULL);
83 } 83 }
84 } 84 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc ('k') | chrome/browser/ui/webui/ntp/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698