| 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);
|
|
|