| Index: chrome/common/extensions/extension_message_bundle.cc
|
| diff --git a/chrome/common/extensions/extension_message_bundle.cc b/chrome/common/extensions/extension_message_bundle.cc
|
| index 8dd52750fd6be258f0a63d5409aa755af24777d8..4e6222fd88d8cfe9ed5bddca3a8bb5c3aeca7dfc 100644
|
| --- a/chrome/common/extensions/extension_message_bundle.cc
|
| +++ b/chrome/common/extensions/extension_message_bundle.cc
|
| @@ -14,6 +14,7 @@
|
| #include "base/scoped_ptr.h"
|
| #include "base/singleton.h"
|
| #include "base/stl_util-inl.h"
|
| +#include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "chrome/common/extensions/extension_constants.h"
|
| @@ -211,6 +212,9 @@ bool ExtensionMessageBundle::ReplaceMessages(std::string* text,
|
| return ReplaceMessagesWithExternalDictionary(dictionary_, text, error);
|
| }
|
|
|
| +ExtensionMessageBundle::~ExtensionMessageBundle() {
|
| +}
|
| +
|
| // static
|
| bool ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary(
|
| const SubstitutionMap& dictionary, std::string* text, std::string* error) {
|
| @@ -270,6 +274,21 @@ bool ExtensionMessageBundle::ReplaceVariables(
|
| return true;
|
| }
|
|
|
| +// static
|
| +bool ExtensionMessageBundle::IsValidName(const std::string& name) {
|
| + if (name.empty())
|
| + return false;
|
| +
|
| + std::string::const_iterator it = name.begin();
|
| + for (; it != name.end(); ++it) {
|
| + // Allow only ascii 0-9, a-z, A-Z, and _ in the name.
|
| + if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it) && *it != '_' && *it != '@')
|
| + return false;
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| // Dictionary interface.
|
|
|
| std::string ExtensionMessageBundle::GetL10nMessage(
|
|
|