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

Side by Side Diff: chrome/renderer/extensions/renderer_extension_bindings.cc

Issue 628009: Adding @@extension_id reserved message to l10n message map for extension.... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension_message_filter_peer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/extensions/renderer_extension_bindings.h" 5 #include "chrome/renderer/extensions/renderer_extension_bindings.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // from the correct source. 191 // from the correct source.
192 RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); 192 RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext();
193 if (!renderview) 193 if (!renderview)
194 return v8::Undefined(); 194 return v8::Undefined();
195 195
196 L10nMessagesMap messages; 196 L10nMessagesMap messages;
197 // A sync call to load message catalogs for current extension. 197 // A sync call to load message catalogs for current extension.
198 renderview->Send(new ViewHostMsg_GetExtensionMessageBundle( 198 renderview->Send(new ViewHostMsg_GetExtensionMessageBundle(
199 extension_id, &messages)); 199 extension_id, &messages));
200 200
201 if (messages.empty())
202 return v8::Undefined();
203
204 // Save messages we got. 201 // Save messages we got.
205 ExtensionToL10nMessagesMap& l10n_messages_map = 202 ExtensionToL10nMessagesMap& l10n_messages_map =
206 *GetExtensionToL10nMessagesMap(); 203 *GetExtensionToL10nMessagesMap();
207 l10n_messages_map[extension_id] = messages; 204 l10n_messages_map[extension_id] = messages;
208 205
209 l10n_messages = GetL10nMessagesMap(extension_id); 206 l10n_messages = GetL10nMessagesMap(extension_id);
210 } 207 }
211 208
212 std::string message_name = *v8::String::AsciiValue(args[0]); 209 std::string message_name = *v8::String::AsciiValue(args[0]);
213 std::string message = 210 std::string message =
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 return extension; 296 return extension;
300 } 297 }
301 298
302 void RendererExtensionBindings::Invoke(const std::string& function_name, 299 void RendererExtensionBindings::Invoke(const std::string& function_name,
303 const ListValue& args, 300 const ListValue& args,
304 RenderView* renderview) { 301 RenderView* renderview) {
305 v8::HandleScope handle_scope; 302 v8::HandleScope handle_scope;
306 std::vector< v8::Handle<v8::Value> > argv = ListValueToV8(args); 303 std::vector< v8::Handle<v8::Value> > argv = ListValueToV8(args);
307 EventBindings::CallFunction(function_name, argv.size(), &argv[0], renderview); 304 EventBindings::CallFunction(function_name, argv.size(), &argv[0], renderview);
308 } 305 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_message_filter_peer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698