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

Unified Diff: chrome/common/extensions/extension_message_bundle.h

Issue 570007: Replace __MSG_some_name__ template within extension css/html files with local... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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_message_bundle.h
===================================================================
--- chrome/common/extensions/extension_message_bundle.h (revision 38490)
+++ chrome/common/extensions/extension_message_bundle.h (working copy)
@@ -71,6 +71,9 @@
// Returns false if there is a message in text that's not defined in the
// dictionary.
bool ReplaceMessages(std::string* text, std::string* error) const;
+ // Static version that accepts dictionary.
+ static bool ReplaceMessagesWithExternalDictionary(
+ const SubstitutionMap& dictionary, std::string* text, std::string* error);
// Replaces each occurance of variable placeholder with its value.
// I.e. replaces __MSG_name__ with value from the catalog with the key "name".
@@ -145,4 +148,28 @@
SubstitutionMap dictionary_;
};
+///////////////////////////////////////////////////////////////////////////////
+//
+// Renderer helper typedefs and functions.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+// A map of message name to message.
+typedef std::map<std::string, std::string> L10nMessagesMap;
+
+// A map of extension ID to l10n message map.
+typedef std::map<std::string, L10nMessagesMap > ExtensionToL10nMessagesMap;
+
+// Unique class for Singleton.
+struct ExtensionToMessagesMap {
+ // Maps extension ID to message map.
+ ExtensionToL10nMessagesMap messages_map;
+};
+
+// Returns the extension_id to messages map.
+ExtensionToL10nMessagesMap* GetExtensionToL10nMessagesMap();
+
+// Returns message map that matches given extension_id, or NULL.
+L10nMessagesMap* GetL10nMessagesMap(const std::string extension_id);
+
#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_
« no previous file with comments | « chrome/common/extensions/extension_l10n_util_unittest.cc ('k') | chrome/common/extensions/extension_message_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698