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

Side by Side Diff: chrome/browser/extensions/script_executor.h

Issue 10383104: Extract executeScript-like functionality into a single ExtensionScriptExecutor class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_
6 #define CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/callback_forward.h"
12 #include "chrome/common/extensions/user_script.h"
13
14 namespace content {
15 class WebContents;
16 }
17
18 namespace extensions {
19
20 // Interface for executing extension content scripts (e.g. executeScript) as
koz (OOO until 15th September) 2012/05/11 01:09:16 Woah, an interface! What is this, Java? :-P
not at google - send to devlin 2012/05/14 02:27:16 I wish!
21 // described by the ExtensionMsg_ExecuteCode_Params IPC, and notifying the
22 // caller when responded with ExtensionHostMsg_ExecuteCodeFinished.
23 class ScriptExecutor {
24 public:
25 virtual ~ScriptExecutor() {}
26
27 // Callback from ExecuteScript. The arguments are (success, error).
28 typedef base::Callback<void(bool, const std::string&)> ExecuteScriptCallback;
29
30 // Executes a script. The arguments match ExtensionMsg_ExecuteCode_Params in
31 // extension_messages.h (request_id is populated automatically).
32 //
33 // |callback| will always be called even if the IPC'd renderer is destroyed
34 // before a response is received (in this case the callback will be with a
35 // failure and appropriate error message).
36 virtual void ExecuteScript(const std::string& extension_id,
koz (OOO until 15th September) 2012/05/11 01:09:16 I notice that the call sites here become less read
not at google - send to devlin 2012/05/14 02:27:16 I agree these parameters are confusing; particular
37 bool is_javascript,
38 const std::string& code,
39 bool all_frames,
40 UserScript::RunLocation run_at,
41 bool in_main_world,
42 const ExecuteScriptCallback& callback) = 0;
43 };
44
45 } // namespace extensions
46
47 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698