summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-26 22:35:13 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-26 22:35:13 +0000
commit74d5446495a7cfbaba6ce1053f30f0d500c17a17 (patch)
tree92a82901c23a0093698134ded81d6fca552f5e96 /chrome/browser
parentfa41e27861bc166b3e7844939b9799ff0efdffb3 (diff)
downloadchromium_src-74d5446495a7cfbaba6ce1053f30f0d500c17a17.zip
chromium_src-74d5446495a7cfbaba6ce1053f30f0d500c17a17.tar.gz
chromium_src-74d5446495a7cfbaba6ce1053f30f0d500c17a17.tar.bz2
Revert 144055 - 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 TBR=eaugusti@chromium.org Review URL: https://chromiumcodereview.appspot.com/10685005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144302 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc14
-rw-r--r--chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h12
-rw-r--r--chrome/browser/extensions/api/tabs/tabs.cc3
-rw-r--r--chrome/browser/extensions/api/tabs/tabs.h3
-rw-r--r--chrome/browser/extensions/execute_script_apitest.cc6
-rw-r--r--chrome/browser/extensions/script_badge_controller.cc5
-rw-r--r--chrome/browser/extensions/script_badge_controller.h7
-rw-r--r--chrome/browser/extensions/script_executor.h11
-rw-r--r--chrome/browser/extensions/script_executor_impl.cc14
9 files changed, 17 insertions, 58 deletions
diff --git a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc
index b967b10..cdcbd0d 100644
--- a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc
+++ b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc
@@ -143,8 +143,7 @@ bool ExecuteCodeInTabFunction::RunImpl() {
void ExecuteCodeInTabFunction::OnExecuteCodeFinished(bool success,
int32 page_id,
- const std::string& error,
- const ListValue& result) {
+ const std::string& error) {
if (!error.empty()) {
CHECK(!success);
error_ = error;
@@ -153,17 +152,6 @@ void ExecuteCodeInTabFunction::OnExecuteCodeFinished(bool success,
SendResponse(success);
}
-
-void TabsExecuteScriptFunction::OnExecuteCodeFinished(bool success,
- int32 page_id,
- const std::string& error,
- const ListValue& result) {
- if (error.empty())
- result_.reset(result.DeepCopy());
- ExecuteCodeInTabFunction::OnExecuteCodeFinished(success, page_id, error,
- result);
-}
-
void ExecuteCodeInTabFunction::DidLoadFile(bool success,
const std::string& data) {
std::string function_name = name();
diff --git a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h
index a954ede..5c97e3e 100644
--- a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h
+++ b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.h
@@ -23,13 +23,12 @@ class ExecuteCodeInTabFunction : public AsyncExtensionFunction {
// ExtensionFunction:
virtual bool RunImpl() OVERRIDE;
+ private:
// Message handler.
- virtual void OnExecuteCodeFinished(bool success,
- int32 page_id,
- const std::string& error,
- const ListValue& script_result);
+ void OnExecuteCodeFinished(bool success,
+ int32 page_id,
+ const std::string& error);
- private:
// Called when contents from the file whose path is specified in JSON
// arguments has been loaded.
void DidLoadFile(bool success, const std::string& data);
@@ -67,9 +66,6 @@ class ExecuteCodeInTabFunction : public AsyncExtensionFunction {
class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction {
private:
virtual ~TabsExecuteScriptFunction() {}
- virtual void OnExecuteCodeFinished(bool success, int32 page_id,
- const std::string& error,
- const ListValue& script_result) OVERRIDE;
DECLARE_EXTENSION_FUNCTION_NAME("tabs.executeScript")
};
diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc
index f245e17..8b2ed1b 100644
--- a/chrome/browser/extensions/api/tabs/tabs.cc
+++ b/chrome/browser/extensions/api/tabs/tabs.cc
@@ -1363,8 +1363,7 @@ void UpdateTabFunction::PopulateResult() {
void UpdateTabFunction::OnExecuteCodeFinished(bool success,
int32 page_id,
- const std::string& error,
- const ListValue& script_result) {
+ const std::string& error) {
if (!error.empty()) {
CHECK(!success);
error_ = error;
diff --git a/chrome/browser/extensions/api/tabs/tabs.h b/chrome/browser/extensions/api/tabs/tabs.h
index f44e4e2..14276a0 100644
--- a/chrome/browser/extensions/api/tabs/tabs.h
+++ b/chrome/browser/extensions/api/tabs/tabs.h
@@ -131,8 +131,7 @@ class UpdateTabFunction : public AsyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
void OnExecuteCodeFinished(bool success,
int32 page_id,
- const std::string& error,
- const ListValue& script_result);
+ const std::string& error);
DECLARE_EXTENSION_FUNCTION_NAME("tabs.update")
};
diff --git a/chrome/browser/extensions/execute_script_apitest.cc b/chrome/browser/extensions/execute_script_apitest.cc
index 1edb440..0594c79 100644
--- a/chrome/browser/extensions/execute_script_apitest.cc
+++ b/chrome/browser/extensions/execute_script_apitest.cc
@@ -78,9 +78,3 @@ IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptRunAt) {
ASSERT_TRUE(StartTestServer());
ASSERT_TRUE(RunExtensionTest("executescript/run_at")) << message_;
}
-
-IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptCallback) {
- SetupDelayedHostResolver();
- ASSERT_TRUE(StartTestServer());
- ASSERT_TRUE(RunExtensionTest("executescript/callback")) << message_;
-}
diff --git a/chrome/browser/extensions/script_badge_controller.cc b/chrome/browser/extensions/script_badge_controller.cc
index 1c770f7..4418557 100644
--- a/chrome/browser/extensions/script_badge_controller.cc
+++ b/chrome/browser/extensions/script_badge_controller.cc
@@ -98,14 +98,13 @@ void ScriptBadgeController::OnExecuteScriptFinished(
const ExecuteScriptCallback& callback,
bool success,
int32 page_id,
- const std::string& error,
- const base::ListValue& script_results) {
+ const std::string& error) {
if (success && page_id == GetPageID()) {
if (InsertExtension(extension_id))
NotifyChange();
}
- callback.Run(success, page_id, error, script_results);
+ callback.Run(success, page_id, error);
}
ExtensionService* ScriptBadgeController::GetExtensionService() {
diff --git a/chrome/browser/extensions/script_badge_controller.h b/chrome/browser/extensions/script_badge_controller.h
index bb5f77d..5361bb2 100644
--- a/chrome/browser/extensions/script_badge_controller.h
+++ b/chrome/browser/extensions/script_badge_controller.h
@@ -24,10 +24,6 @@ class ExtensionAction;
class ExtensionService;
class TabContents;
-namespace base {
-class ListValue;
-}
-
namespace IPC {
class Message;
}
@@ -84,8 +80,7 @@ class ScriptBadgeController
const ExecuteScriptCallback& callback,
bool success,
int32 page_id,
- const std::string& error,
- const base::ListValue& script_result);
+ const std::string& error);
// Gets the ExtensionService for |tab_contents_|.
ExtensionService* GetExtensionService();
diff --git a/chrome/browser/extensions/script_executor.h b/chrome/browser/extensions/script_executor.h
index 93c423e..2119cc6 100644
--- a/chrome/browser/extensions/script_executor.h
+++ b/chrome/browser/extensions/script_executor.h
@@ -11,10 +11,6 @@
#include "base/callback_forward.h"
#include "chrome/common/extensions/user_script.h"
-namespace base {
- class ListValue;
-}
-
namespace content {
class WebContents;
}
@@ -46,10 +42,9 @@ class ScriptExecutor {
ISOLATED_WORLD,
};
- // Callback from ExecuteScript. The arguments are (success, page_id, error,
- // result). page_id is only valid on success, error is only valid on !success.
- typedef base::Callback<void(bool, int32, const std::string&,
- const base::ListValue&)>
+ // Callback from ExecuteScript. The arguments are (success, page_id, error).
+ // page_id is only valid on success, error is only valid on !success.
+ typedef base::Callback<void(bool, int32, const std::string&)>
ExecuteScriptCallback;
// Executes a script. The arguments match ExtensionMsg_ExecuteCode_Params in
diff --git a/chrome/browser/extensions/script_executor_impl.cc b/chrome/browser/extensions/script_executor_impl.cc
index ae8c251..e8f6199 100644
--- a/chrome/browser/extensions/script_executor_impl.cc
+++ b/chrome/browser/extensions/script_executor_impl.cc
@@ -14,10 +14,6 @@
#include "ipc/ipc_message.h"
#include "ipc/ipc_message_macros.h"
-namespace base {
-class ListValue;
-} // namespace base
-
namespace extensions {
namespace {
@@ -62,8 +58,7 @@ class Handler : public content::WebContentsObserver {
}
virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE {
- base::ListValue val;
- callback_.Run(false, -1, kRendererDestroyed, val);
+ callback_.Run(false, -1, kRendererDestroyed);
delete this;
}
@@ -71,9 +66,8 @@ class Handler : public content::WebContentsObserver {
void OnExecuteCodeFinished(int request_id,
bool success,
int32 page_id,
- const std::string& error,
- const base::ListValue& script_result) {
- callback_.Run(success, page_id, error, script_result);
+ const std::string& error) {
+ callback_.Run(success, page_id, error);
delete this;
}
@@ -104,7 +98,7 @@ void ScriptExecutorImpl::ExecuteScript(
params.is_javascript = (script_type == JAVASCRIPT);
params.code = code;
params.all_frames = (frame_scope == ALL_FRAMES);
- params.run_at = static_cast<int>(run_at);
+ params.run_at = (int) run_at;
params.in_main_world = (world_type == MAIN_WORLD);
// Handler handles IPCs and deletes itself on completion.