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

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

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // We receive the url with chrome://fileicon/ stripped but GURL expects it. 45 // We receive the url with chrome://fileicon/ stripped but GURL expects it.
46 const GURL gurl("chrome://fileicon/" + url); 46 const GURL gurl("chrome://fileicon/" + url);
47 std::string path = net::UnescapeURLComponent( 47 std::string path = net::UnescapeURLComponent(
48 gurl.path().substr(1), (net::UnescapeRule::URL_SPECIAL_CHARS | 48 gurl.path().substr(1), (net::UnescapeRule::URL_SPECIAL_CHARS |
49 net::UnescapeRule::SPACES)); 49 net::UnescapeRule::SPACES));
50 50
51 #if defined(OS_WIN) 51 #if defined(OS_WIN)
52 // The path we receive has the wrong slashes and escaping for what we need; 52 // The path we receive has the wrong slashes and escaping for what we need;
53 // this only appears to matter for getting icons from .exe files. 53 // this only appears to matter for getting icons from .exe files.
54 std::replace(path.begin(), path.end(), '/', '\\'); 54 std::replace(path.begin(), path.end(), '/', '\\');
55 *file_path = base::FilePath(UTF8ToWide(path)); 55 *file_path = base::FilePath(base::UTF8ToWide(path));
56 #elif defined(OS_POSIX) 56 #elif defined(OS_POSIX)
57 // The correct encoding on Linux may not actually be UTF8. 57 // The correct encoding on Linux may not actually be UTF8.
58 *file_path = base::FilePath(path); 58 *file_path = base::FilePath(path);
59 #endif 59 #endif
60 query->assign(gurl.query()); 60 query->assign(gurl.query());
61 } 61 }
62 62
63 IconLoader::IconSize SizeStringToIconSize(const std::string& size_string) { 63 IconLoader::IconSize SizeStringToIconSize(const std::string& size_string) {
64 if (size_string == "small") return IconLoader::SMALL; 64 if (size_string == "small") return IconLoader::SMALL;
65 if (size_string == "large") return IconLoader::LARGE; 65 if (size_string == "large") return IconLoader::LARGE;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 .sk_bitmap(), 161 .sk_bitmap(),
162 false, 162 false,
163 &icon_data->data()); 163 &icon_data->data());
164 164
165 details.callback.Run(icon_data); 165 details.callback.Run(icon_data);
166 } else { 166 } else {
167 // TODO(glen): send a dummy icon. 167 // TODO(glen): send a dummy icon.
168 details.callback.Run(NULL); 168 details.callback.Run(NULL);
169 } 169 }
170 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/pack_extension_handler.cc ('k') | chrome/browser/ui/webui/version_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698