OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_BROWSER_SCRIPT_EXECUTOR_H_ | 5 #ifndef EXTENSIONS_BROWSER_SCRIPT_EXECUTOR_H_ |
6 #define EXTENSIONS_BROWSER_SCRIPT_EXECUTOR_H_ | 6 #define EXTENSIONS_BROWSER_SCRIPT_EXECUTOR_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "extensions/common/user_script.h" | 10 #include "extensions/common/user_script.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Interface for executing extension content scripts (e.g. executeScript) as | 26 // Interface for executing extension content scripts (e.g. executeScript) as |
27 // described by the ExtensionMsg_ExecuteCode_Params IPC, and notifying the | 27 // described by the ExtensionMsg_ExecuteCode_Params IPC, and notifying the |
28 // caller when responded with ExtensionHostMsg_ExecuteCodeFinished. | 28 // caller when responded with ExtensionHostMsg_ExecuteCodeFinished. |
29 class ScriptExecutor { | 29 class ScriptExecutor { |
30 public: | 30 public: |
31 ScriptExecutor( | 31 ScriptExecutor( |
32 content::WebContents* web_contents, | 32 content::WebContents* web_contents, |
33 // |script_observers| is assumed to be owned by |this|'s owner, and in | 33 // |script_observers| is assumed to be owned by |this|'s owner, and in |
34 // such a way that |this| is destroyed first. | 34 // such a way that |this| is destroyed first. |
35 ObserverList<ScriptExecutionObserver>* script_observers); | 35 base::ObserverList<ScriptExecutionObserver>* script_observers); |
36 | 36 |
37 ~ScriptExecutor(); | 37 ~ScriptExecutor(); |
38 | 38 |
39 // The type of script being injected. | 39 // The type of script being injected. |
40 enum ScriptType { | 40 enum ScriptType { |
41 JAVASCRIPT, | 41 JAVASCRIPT, |
42 CSS, | 42 CSS, |
43 }; | 43 }; |
44 | 44 |
45 // The scope of the script injection across the frames. | 45 // The scope of the script injection across the frames. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bool user_gesture, | 98 bool user_gesture, |
99 ResultType result_type, | 99 ResultType result_type, |
100 const ExecuteScriptCallback& callback); | 100 const ExecuteScriptCallback& callback); |
101 | 101 |
102 private: | 102 private: |
103 // The next value to use for request_id in ExtensionMsg_ExecuteCode_Params. | 103 // The next value to use for request_id in ExtensionMsg_ExecuteCode_Params. |
104 int next_request_id_; | 104 int next_request_id_; |
105 | 105 |
106 content::WebContents* web_contents_; | 106 content::WebContents* web_contents_; |
107 | 107 |
108 ObserverList<ScriptExecutionObserver>* script_observers_; | 108 base::ObserverList<ScriptExecutionObserver>* script_observers_; |
109 }; | 109 }; |
110 | 110 |
111 } // namespace extensions | 111 } // namespace extensions |
112 | 112 |
113 #endif // EXTENSIONS_BROWSER_SCRIPT_EXECUTOR_H_ | 113 #endif // EXTENSIONS_BROWSER_SCRIPT_EXECUTOR_H_ |
OLD | NEW |