From 771baf0c6d0a97c3a10eb6448c2161daf351fb40 Mon Sep 17 00:00:00 2001 From: "eaugusti@chromium.org" Date: Mon, 25 Jun 2012 23:34:31 +0000 Subject: Uses the result of injected js as an optional parameter to an optional callback. This feature requires changes to WebKitt. The diff for these changes are here: https://gist.github.com/1732015 BUG=22349 Review URL: https://chromiumcodereview.appspot.com/9325032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144055 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/script_executor_impl.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'chrome/browser/extensions/script_executor_impl.cc') diff --git a/chrome/browser/extensions/script_executor_impl.cc b/chrome/browser/extensions/script_executor_impl.cc index e8f6199..ae8c251 100644 --- a/chrome/browser/extensions/script_executor_impl.cc +++ b/chrome/browser/extensions/script_executor_impl.cc @@ -14,6 +14,10 @@ #include "ipc/ipc_message.h" #include "ipc/ipc_message_macros.h" +namespace base { +class ListValue; +} // namespace base + namespace extensions { namespace { @@ -58,7 +62,8 @@ class Handler : public content::WebContentsObserver { } virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE { - callback_.Run(false, -1, kRendererDestroyed); + base::ListValue val; + callback_.Run(false, -1, kRendererDestroyed, val); delete this; } @@ -66,8 +71,9 @@ class Handler : public content::WebContentsObserver { void OnExecuteCodeFinished(int request_id, bool success, int32 page_id, - const std::string& error) { - callback_.Run(success, page_id, error); + const std::string& error, + const base::ListValue& script_result) { + callback_.Run(success, page_id, error, script_result); delete this; } @@ -98,7 +104,7 @@ void ScriptExecutorImpl::ExecuteScript( params.is_javascript = (script_type == JAVASCRIPT); params.code = code; params.all_frames = (frame_scope == ALL_FRAMES); - params.run_at = (int) run_at; + params.run_at = static_cast(run_at); params.in_main_world = (world_type == MAIN_WORLD); // Handler handles IPCs and deletes itself on completion. -- cgit v1.1