| 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 44d03f23a7c0ef934529dfa809de11f73d17e9f0..6ea22f668c9b4f53de9b210ce3071734da51c21e 100644
|
| --- a/chrome/browser/extensions/execute_code_in_tab_function.cc
|
| +++ b/chrome/browser/extensions/execute_code_in_tab_function.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/bind.h"
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| +#include "chrome/browser/extensions/script_executor.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/extensions/extension_tab_util.h"
|
| #include "chrome/browser/extensions/extension_tabs_module.h"
|
| @@ -141,29 +142,7 @@ bool ExecuteCodeInTabFunction::RunImpl() {
|
| return true;
|
| }
|
|
|
| -bool ExecuteCodeInTabFunction::OnMessageReceived(const IPC::Message& message) {
|
| - if (message.type() != ExtensionHostMsg_ExecuteCodeFinished::ID)
|
| - return false;
|
| -
|
| - int message_request_id;
|
| - PickleIterator iter(message);
|
| - if (!message.ReadInt(&iter, &message_request_id)) {
|
| - NOTREACHED() << "malformed extension message";
|
| - return true;
|
| - }
|
| -
|
| - if (message_request_id != request_id())
|
| - return false;
|
| -
|
| - IPC_BEGIN_MESSAGE_MAP(ExecuteCodeInTabFunction, message)
|
| - IPC_MESSAGE_HANDLER(ExtensionHostMsg_ExecuteCodeFinished,
|
| - OnExecuteCodeFinished)
|
| - IPC_END_MESSAGE_MAP()
|
| - return true;
|
| -}
|
| -
|
| -void ExecuteCodeInTabFunction::OnExecuteCodeFinished(int request_id,
|
| - bool success,
|
| +void ExecuteCodeInTabFunction::OnExecuteCodeFinished(bool success,
|
| const std::string& error) {
|
| if (!error.empty()) {
|
| CHECK(!success);
|
| @@ -171,9 +150,6 @@ void ExecuteCodeInTabFunction::OnExecuteCodeFinished(int request_id,
|
| }
|
|
|
| SendResponse(success);
|
| -
|
| - Observe(NULL);
|
| - Release(); // balanced in Execute()
|
| }
|
|
|
| void ExecuteCodeInTabFunction::DidLoadFile(bool success,
|
| @@ -267,20 +243,13 @@ bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) {
|
| DCHECK(false);
|
| }
|
|
|
| - ExtensionMsg_ExecuteCode_Params params;
|
| - params.request_id = request_id();
|
| - params.extension_id = extension->id();
|
| - params.is_javascript = is_js_code;
|
| - params.code = code_string;
|
| - params.all_frames = all_frames_;
|
| - params.run_at = run_at_;
|
| - params.in_main_world = false;
|
| - contents->web_contents()->GetRenderViewHost()->Send(
|
| - new ExtensionMsg_ExecuteCode(
|
| - contents->web_contents()->GetRenderViewHost()->GetRoutingID(),
|
| - params));
|
| -
|
| - Observe(contents->web_contents());
|
| - AddRef(); // balanced in OnExecuteCodeFinished()
|
| + contents->extension_script_executor()->ExecuteScript(
|
| + extension->id(),
|
| + is_js_code,
|
| + code_string,
|
| + all_frames_,
|
| + run_at_,
|
| + false,
|
| + base::Bind(&ExecuteCodeInTabFunction::OnExecuteCodeFinished, this));
|
| return true;
|
| }
|
|
|