diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 22:22:07 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 22:22:07 +0000 |
commit | 967d18bad65a0dc0cf8d0207cbd2cf82651752b8 (patch) | |
tree | 2d06825366c1d876dd432b60db417565dc3d4e7e /chrome/common | |
parent | 849991d6cebb241a26db85ba50b4e0c2a6b6a80c (diff) | |
download | chromium_src-967d18bad65a0dc0cf8d0207cbd2cf82651752b8.zip chromium_src-967d18bad65a0dc0cf8d0207cbd2cf82651752b8.tar.gz chromium_src-967d18bad65a0dc0cf8d0207cbd2cf82651752b8.tar.bz2 |
wstring: remove some simple instances of ToWStringHack
BUG=69467
Review URL: http://codereview.chromium.org/6588131
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/extensions/extension_l10n_util.cc | 7 | ||||
-rw-r--r-- | chrome/common/extensions/extension_unpacker.cc | 19 | ||||
-rw-r--r-- | chrome/common/zip_unittest.cc | 2 |
3 files changed, 19 insertions, 9 deletions
diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index dad4d06..0874046 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -199,8 +199,11 @@ bool GetValidLocales(const FilePath& locale_path, file_util::FileEnumerator::DIRECTORIES); FilePath locale_folder; while (!(locale_folder = locales.Next()).empty()) { - std::string locale_name = - WideToASCII(locale_folder.BaseName().ToWStringHack()); + std::string locale_name = locale_folder.BaseName().MaybeAsASCII(); + if (locale_name.empty()) { + NOTREACHED(); + continue; // Not ASCII. + } if (!AddLocale(chrome_locales, locale_folder, locale_name, diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc index e001911..25919cf 100644 --- a/chrome/common/extensions/extension_unpacker.cc +++ b/chrome/common/extensions/extension_unpacker.cc @@ -286,13 +286,14 @@ bool ExtensionUnpacker::ReadMessageCatalog(const FilePath& message_path) { scoped_ptr<DictionaryValue> root( static_cast<DictionaryValue*>(serializer.Deserialize(NULL, &error))); if (!root.get()) { - std::string messages_file = WideToASCII(message_path.ToWStringHack()); + string16 messages_file = message_path.LossyDisplayName(); if (error.empty()) { // If file is missing, Deserialize will fail with empty error. SetError(base::StringPrintf("%s %s", errors::kLocalesMessagesFileMissing, - messages_file.c_str())); + UTF16ToUTF8(messages_file).c_str())); } else { - SetError(base::StringPrintf("%s: %s", messages_file.c_str(), + SetError(base::StringPrintf("%s: %s", + UTF16ToUTF8(messages_file).c_str(), error.c_str())); } return false; @@ -300,11 +301,17 @@ bool ExtensionUnpacker::ReadMessageCatalog(const FilePath& message_path) { FilePath relative_path; // message_path was created from temp_install_dir. This should never fail. - if (!temp_install_dir_.AppendRelativePath(message_path, &relative_path)) + if (!temp_install_dir_.AppendRelativePath(message_path, &relative_path)) { NOTREACHED(); + return false; + } - parsed_catalogs_->Set(WideToUTF8(relative_path.DirName().ToWStringHack()), - root.release()); + std::string dir_name = relative_path.DirName().MaybeAsASCII(); + if (dir_name.empty()) { + NOTREACHED(); + return false; + } + parsed_catalogs_->Set(dir_name, root.release()); return true; } diff --git a/chrome/common/zip_unittest.cc b/chrome/common/zip_unittest.cc index afb50c0..d7c73c5 100644 --- a/chrome/common/zip_unittest.cc +++ b/chrome/common/zip_unittest.cc @@ -71,7 +71,7 @@ class ZipTest : public PlatformTest { size_t expected_count = 0; for (std::set<FilePath>::iterator iter = zip_contents_.begin(); iter != zip_contents_.end(); ++iter) { - if (expect_hidden_files || iter->BaseName().ToWStringHack()[0] != L'.') + if (expect_hidden_files || iter->BaseName().value()[0] != '.') ++expected_count; } |