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

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: Updated. 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..7c71bc115f968806edc7400c7f4fbc7762c76c3a 100644
--- a/chrome/browser/extensions/execute_code_in_tab_function.cc
+++ b/chrome/browser/extensions/execute_code_in_tab_function.cc
@@ -17,7 +17,10 @@
#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_l10n_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 +164,12 @@ bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) {
}
bool is_js_code = true;
+ // We need to do message replacement on code_string, so it must be mutable.
+ std::string code_string_to_execute = code_string;
std::string function_name = name();
if (function_name == TabsInsertCSSFunction::function_name()) {
is_js_code = false;
+ extension_l10n_util::LocalizeCSSScript(extension, code_string_to_execute);
Mihai Parparita -not on Chrome 2011/08/11 01:58:34 I don't think you want to do this when you're pass
Mihai Parparita -not on Chrome 2011/08/11 01:58:34 LocalizeCSSScript ends up doing file IO (to load t
adriansc 2011/08/11 21:25:08 I moved the localization logic to the file thread
adriansc 2011/08/11 21:25:08 Done. Localization is only called in DidLoadFile n
} else if (function_name != TabsExecuteScriptFunction::function_name()) {
DCHECK(false);
}
@@ -172,7 +178,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(

Powered by Google App Engine
This is Rietveld 408576698