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

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

Issue 671011: All platforms don't support same locales at the same time. Make locale check ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension_unpacker.cc
===================================================================
--- chrome/common/extensions/extension_unpacker.cc (revision 40922)
+++ chrome/common/extensions/extension_unpacker.cc (working copy)
@@ -15,6 +15,7 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_file_util.h"
+#include "chrome/common/extensions/extension_l10n_util.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/url_constants.h"
@@ -115,22 +116,17 @@
FilePath locales_path =
temp_install_dir_.Append(Extension::kLocaleFolder);
- // Treat all folders under _locales as valid locales.
+ // Not all folders under _locales are valid locales.
file_util::FileEnumerator locales(locales_path,
false,
file_util::FileEnumerator::DIRECTORIES);
- FilePath locale_path = locales.Next();
- do {
- // Since we use this string as a key in a DictionaryValue, be paranoid about
- // skipping any strings with '.'. This happens sometimes, for example with
- // '.svn' directories.
- FilePath relative_path;
- // message_path was created from temp_install_dir. This should never fail.
- if (!temp_install_dir_.AppendRelativePath(locale_path, &relative_path))
- NOTREACHED();
- std::wstring subdir(relative_path.ToWStringHack());
- if (std::find(subdir.begin(), subdir.end(), L'.') != subdir.end())
+ std::set<std::string> all_locales;
+ extension_l10n_util::GetAllLocales(&all_locales);
+ FilePath locale_path;
+ while (!(locale_path = locales.Next()).empty()) {
+ if (extension_l10n_util::ShouldSkipValidation(locales_path, locale_path,
+ all_locales))
continue;
FilePath messages_path =
@@ -138,7 +134,7 @@
if (!ReadMessageCatalog(messages_path))
return false;
- } while (!(locale_path = locales.Next()).empty());
+ }
return true;
}
« no previous file with comments | « chrome/common/extensions/extension_l10n_util_unittest.cc ('k') | chrome/common/extensions/extension_unpacker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698