diff options
Diffstat (limited to 'chrome/renderer/extensions/bindings_utils.cc')
-rw-r--r-- | chrome/renderer/extensions/bindings_utils.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/chrome/renderer/extensions/bindings_utils.cc b/chrome/renderer/extensions/bindings_utils.cc index 83ddeee..5b213c4 100644 --- a/chrome/renderer/extensions/bindings_utils.cc +++ b/chrome/renderer/extensions/bindings_utils.cc @@ -22,6 +22,20 @@ struct SingletonData { PendingRequestMap pending_requests; }; +typedef std::map<int, std::string> StringMap; + +const char* GetStringResource(int resource_id) { + StringMap* strings = Singleton<StringMap>::get(); + StringMap::iterator it = strings->find(resource_id); + if (it == strings->end()) { + it = strings->insert(std::make_pair( + resource_id, + ResourceBundle::GetSharedInstance().GetRawDataResource( + resource_id).as_string())).first; + } + return it->second.c_str(); +} + // ExtensionBase v8::Handle<v8::FunctionTemplate> |