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

Unified Diff: chrome/browser/extensions/execute_code_in_tab_function.cc

Issue 7552028: Injected CSS localization fix (see bug no.) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Inserted whitespace. Created 9 years, 4 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/browser/extensions/execute_code_in_tab_function.cc
diff --git a/chrome/browser/extensions/execute_code_in_tab_function.cc b/chrome/browser/extensions/execute_code_in_tab_function.cc
index b5eb0d57a23db074db9c9467e084ad070d6bb67e..f9af03d070b57c2b8130651bb63f4ebf17e57cc5 100644
--- a/chrome/browser/extensions/execute_code_in_tab_function.cc
+++ b/chrome/browser/extensions/execute_code_in_tab_function.cc
@@ -17,7 +17,9 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_error_utils.h"
+#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/extension_messages.h"
+#include "chrome/common/extensions/extension_message_bundle.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -161,9 +163,17 @@ bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) {
}
bool is_js_code = true;
+ std::string code_string_to_execute = code_string;
Nebojša Ćirić 2011/08/10 20:38:57 Why change name here? You could just rename the fu
adriansc 2011/08/10 23:20:53 The code_string gets passed in the binding as a co
std::string function_name = name();
if (function_name == TabsInsertCSSFunction::function_name()) {
is_js_code = false;
+ // Localize CSS messages.
+ std::string error;
+ const SubstitutionMap localization_messages =
+ extension_file_util::LoadExtensionMessageBundleSubstitutionMap(
+ extension->path(), extension->id(), extension->default_locale());
+ ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary(
+ localization_messages, &code_string_to_execute, &error);
Nebojša Ćirić 2011/08/10 20:38:57 If this code snippet shows up in other places you
adriansc 2011/08/10 23:20:53 Moved to extension_l10n_utils
} else if (function_name != TabsExecuteScriptFunction::function_name()) {
DCHECK(false);
}
@@ -172,7 +182,7 @@ bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) {
params.request_id = request_id();
params.extension_id = extension->id();
params.is_javascript = is_js_code;
- params.code = code_string;
+ params.code = code_string_to_execute;
params.all_frames = all_frames_;
params.in_main_world = false;
contents->render_view_host()->Send(new ExtensionMsg_ExecuteCode(
« no previous file with comments | « no previous file | chrome/browser/extensions/user_script_master.h » ('j') | chrome/browser/extensions/user_script_master.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698