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

Unified Diff: chrome/common/extensions/extension_file_util.cc

Issue 6246036: FilePath: Remove most of ToWStringHack, adding a LossyDisplayName() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retry Created 9 years, 11 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
Index: chrome/common/extensions/extension_file_util.cc
diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc
index 44668e8247a2ef7a5642d8f55a5468f124d63916..930cd859a4af9a4e155e4c95c0a9178eb729d1da 100644
--- a/chrome/common/extensions/extension_file_util.cc
+++ b/chrome/common/extensions/extension_file_util.cc
@@ -161,7 +161,7 @@ bool ValidateExtension(Extension* extension, std::string* error) {
if (!file_util::PathExists(image_path)) {
*error =
l10n_util::GetStringFUTF8(IDS_EXTENSION_INVALID_IMAGE_PATH,
- WideToUTF16(image_path.ToWStringHack()));
+ image_path.LossyDisplayName());
return false;
}
}
@@ -203,7 +203,7 @@ bool ValidateExtension(Extension* extension, std::string* error) {
*error =
l10n_util::GetStringFUTF8(
IDS_EXTENSION_LOAD_PLUGIN_PATH_FAILED,
- WideToUTF16(plugin.path.ToWStringHack()));
+ plugin.path.LossyDisplayName());
return false;
}
}
@@ -250,7 +250,7 @@ bool ValidateExtension(Extension* extension, std::string* error) {
*error =
l10n_util::GetStringFUTF8(
IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED,
- WideToUTF16(page_path.ToWStringHack()));
+ page_path.LossyDisplayName());
return false;
}
}
@@ -265,7 +265,7 @@ bool ValidateExtension(Extension* extension, std::string* error) {
*error =
l10n_util::GetStringFUTF8(
IDS_EXTENSION_LOAD_OPTIONS_PAGE_FAILED,
- WideToUTF16(options_path.ToWStringHack()));
+ options_path.LossyDisplayName());
return false;
}
}
@@ -280,7 +280,7 @@ bool ValidateExtension(Extension* extension, std::string* error) {
*error =
l10n_util::GetStringFUTF8(
IDS_EXTENSION_LOAD_SIDEBAR_PAGE_FAILED,
- WideToUTF16(page_path.ToWStringHack()));
+ page_path.LossyDisplayName());
return false;
}
}
@@ -312,15 +312,15 @@ void GarbageCollectExtensions(
FilePath extension_path;
for (extension_path = enumerator.Next(); !extension_path.value().empty();
extension_path = enumerator.Next()) {
- std::string extension_id = WideToASCII(
- extension_path.BaseName().ToWStringHack());
+ std::string extension_id = UTF16ToASCII(
+ extension_path.BaseName().LossyDisplayName());
Avi (use Gerrit) 2011/02/04 19:24:53 So this will DCHECK when a user puts a stupidly-na
evanm 2011/02/04 19:37:12 I guess DCHECKing is OK, since it is breaking an a
Avi (use Gerrit) 2011/02/04 19:42:32 I think I have a different expectation of what a D
evanm 2011/02/04 19:58:50 OK, I wrote some more thorough checking.
// Delete directories that aren't valid IDs.
if (!Extension::IdIsValid(extension_id)) {
LOG(WARNING) << "Invalid extension ID encountered in extensions "
"directory: " << extension_id;
VLOG(1) << "Deleting invalid extension directory "
- << WideToASCII(extension_path.ToWStringHack()) << ".";
+ << extension_path.LossyDisplayName() << ".";
file_util::Delete(extension_path, true); // Recursive.
continue;
}
@@ -333,7 +333,7 @@ void GarbageCollectExtensions(
// complete, for example, when a plugin is in use at uninstall time.
if (iter == extension_paths.end()) {
VLOG(1) << "Deleting unreferenced install for directory "
- << WideToASCII(extension_path.ToWStringHack()) << ".";
+ << extension_path.LossyDisplayName() << ".";
file_util::Delete(extension_path, true); // Recursive.
continue;
}
@@ -348,7 +348,7 @@ void GarbageCollectExtensions(
version_dir = versions_enumerator.Next()) {
if (version_dir.BaseName() != iter->second.BaseName()) {
VLOG(1) << "Deleting old version for directory "
- << WideToASCII(version_dir.ToWStringHack()) << ".";
+ << version_dir.LossyDisplayName() << ".";
file_util::Delete(version_dir, true); // Recursive.
}
}
@@ -428,7 +428,7 @@ static bool ValidateLocaleInfo(const Extension& extension, std::string* error) {
if (!file_util::PathExists(messages_path)) {
*error = base::StringPrintf(
"%s %s", errors::kLocalesMessagesFileMissing,
- WideToUTF8(messages_path.ToWStringHack()).c_str());
+ UTF16ToUTF8(messages_path.LossyDisplayName()).c_str());
Mark Mentovai 2011/02/04 19:26:58 :(
return false;
}
@@ -454,14 +454,14 @@ static bool IsScriptValid(const FilePath& path,
!file_util::ReadFileToString(path, &content)) {
*error = l10n_util::GetStringFUTF8(
message_id,
- WideToUTF16(relative_path.ToWStringHack()));
+ relative_path.LossyDisplayName());
return false;
}
if (!IsStringUTF8(content)) {
*error = l10n_util::GetStringFUTF8(
IDS_EXTENSION_BAD_FILE_ENCODING,
- WideToUTF16(relative_path.ToWStringHack()));
+ relative_path.LossyDisplayName());
return false;
}

Powered by Google App Engine
This is Rietveld 408576698