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

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

Issue 337041: Fix bug where many extensions don't install due to sandbox. (Closed)
Patch Set: Attempt to fix a deps issue Created 11 years, 2 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_l10n_util.cc
diff --git a/chrome/browser/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc
similarity index 94%
rename from chrome/browser/extensions/extension_l10n_util.cc
rename to chrome/common/extensions/extension_l10n_util.cc
index 1ac93ffdbac74afcc08d8e386bfd1bebbd62dbaa..bd8431d76fd44f4265d394052799da8740d6e732 100644
--- a/chrome/browser/extensions/extension_l10n_util.cc
+++ b/chrome/common/extensions/extension_l10n_util.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/extensions/extension_l10n_util.h"
+#include "chrome/common/extensions/extension_l10n_util.h"
#include <set>
#include <string>
@@ -21,8 +21,17 @@
namespace errors = extension_manifest_errors;
namespace keys = extension_manifest_keys;
+static std::string* GetProcessLocale() {
+ static std::string locale;
+ return &locale;
+}
+
namespace extension_l10n_util {
+void SetProcessLocale(const std::string& locale) {
+ *(GetProcessLocale()) = locale;
+}
+
std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest,
std::string* error) {
std::string default_locale;
@@ -187,10 +196,12 @@ void GetL10nRelativePaths(const FilePath& relative_resource_path,
std::vector<FilePath>* l10n_paths) {
DCHECK(NULL != l10n_paths);
+ std::string* current_locale = GetProcessLocale();
+ if (current_locale->empty())
+ *current_locale = l10n_util::GetApplicationLocale(L"");
Nebojša Ćirić 2009/10/27 22:04:35 No big deal, but you could use SetProcessLocale(l
+
std::vector<std::string> locales;
- static const std::string current_locale =
- l10n_util::GetApplicationLocale(L"");
- GetParentLocales(current_locale, &locales);
+ GetParentLocales(*current_locale, &locales);
FilePath locale_relative_path;
for (size_t i = 0; i < locales.size(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698