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

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

Issue 7552028: Injected CSS localization fix (see bug no.) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Cleaned up old unused function. Created 9 years, 4 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
« no previous file with comments | « chrome/common/extensions/extension_file_util.h ('k') | chrome/common/extensions/extension_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e7ba1951cab879cb8794f113519fca55ae4b1f16..55ca7de731f10f33af564810bd2c06a14999b3a0 100644
--- a/chrome/common/extensions/extension_file_util.cc
+++ b/chrome/common/extensions/extension_file_util.cc
@@ -20,6 +20,8 @@
#include "chrome/common/extensions/extension_action.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_l10n_util.h"
+#include "chrome/common/extensions/extension_messages.h"
+#include "chrome/common/extensions/extension_message_bundle.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/extensions/extension_sidebar_defaults.h"
#include "content/common/json_value_serializer.h"
@@ -400,6 +402,29 @@ ExtensionMessageBundle* LoadExtensionMessageBundle(
return message_bundle;
}
+SubstitutionMap* LoadExtensionMessageBundleSubstitutionMap(
+ const FilePath& extension_path,
+ const std::string& extension_id,
+ const std::string& default_locale) {
+ SubstitutionMap* returnValue = new SubstitutionMap();
+ if (!default_locale.empty()) {
+ // Touch disk only if extension is localized.
+ std::string error;
+ scoped_ptr<ExtensionMessageBundle> bundle(
+ LoadExtensionMessageBundle(extension_path, default_locale, &error));
+
+ if (bundle.get())
+ *returnValue = *bundle->dictionary();
+ }
+
+ // Add @@extension_id reserved message here, so it's available to
+ // non-localized extensions too.
+ returnValue->insert(
+ std::make_pair(ExtensionMessageBundle::kExtensionIdKey, extension_id));
+
+ return returnValue;
+}
+
static bool ValidateLocaleInfo(const Extension& extension, std::string* error) {
// default_locale and _locales have to be both present or both missing.
const FilePath path = extension.path().Append(Extension::kLocaleFolder);
« no previous file with comments | « chrome/common/extensions/extension_file_util.h ('k') | chrome/common/extensions/extension_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698