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

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

Issue 225009: Implementing chrome.i18n.getMessage call, that loads message from the extensi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 27238)
+++ chrome/common/extensions/extension_message_bundle.h (working copy)
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_
-#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_
+#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_
+#define CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_
+#include <map>
#include <string>
-#include "base/hash_tables.h"
#include "base/values.h"
// Contains localized extension messages for one locale. Any messages that the
// locale does not provide are pulled from the default locale.
class ExtensionMessageBundle {
public:
- typedef base::hash_map<std::string, std::string> SubstitutionMap;
+ typedef std::map<std::string, std::string> SubstitutionMap;
// JSON keys of interest for messages file.
static const wchar_t* kContentKey;
@@ -45,6 +45,10 @@
// #define GetMessage GetMessageW override in Chrome code.
std::string GetL10nMessage(const std::string& name) const;
+ // Get message from the given catalog with given key.
+ static std::string GetL10nMessage(const std::string& name,
+ const SubstitutionMap& dictionary);
+
// Number of messages in the catalog.
// Used for unittesting only.
size_t size() const { return dictionary_.size(); }
@@ -71,6 +75,9 @@
template<typename str>
static bool IsValidName(const str& name);
+ // Getter for dictionary_.
+ const SubstitutionMap* dictionary() const { return &dictionary_; }
+
private:
// Use Create to create ExtensionMessageBundle instance.
ExtensionMessageBundle();
@@ -107,4 +114,4 @@
SubstitutionMap dictionary_;
};
-#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_
+#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGE_BUNDLE_H_

Powered by Google App Engine
This is Rietveld 408576698