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_RENDERER_SCRIPT_INJECTION_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ |
6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> |
11 | 12 |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "extensions/common/user_script.h" | 16 #include "extensions/common/user_script.h" |
16 #include "extensions/renderer/injection_host.h" | 17 #include "extensions/renderer/injection_host.h" |
17 #include "extensions/renderer/script_injector.h" | 18 #include "extensions/renderer/script_injector.h" |
18 | 19 |
19 struct HostID; | 20 struct HostID; |
20 | 21 |
21 namespace blink { | |
22 template<typename T> class WebVector; | |
23 } | |
24 | |
25 namespace content { | 22 namespace content { |
26 class RenderFrame; | 23 class RenderFrame; |
27 } | 24 } |
28 | 25 |
29 namespace v8 { | 26 namespace v8 { |
30 class Value; | 27 class Value; |
31 template <class T> class Local; | 28 template <class T> class Local; |
32 } | 29 } |
33 | 30 |
34 namespace extensions { | 31 namespace extensions { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 92 |
96 // Injects the script. Returns INJECTION_FINISHED if injection has finished, | 93 // Injects the script. Returns INJECTION_FINISHED if injection has finished, |
97 // otherwise INJECTION_BLOCKED. | 94 // otherwise INJECTION_BLOCKED. |
98 InjectionResult Inject(ScriptsRunInfo* scripts_run_info); | 95 InjectionResult Inject(ScriptsRunInfo* scripts_run_info); |
99 | 96 |
100 // Inject any JS scripts into the frame for the injection. | 97 // Inject any JS scripts into the frame for the injection. |
101 void InjectJs(std::set<std::string>* executing_scripts, | 98 void InjectJs(std::set<std::string>* executing_scripts, |
102 size_t* num_injected_js_scripts); | 99 size_t* num_injected_js_scripts); |
103 | 100 |
104 // Called when JS injection for the given frame has been completed. | 101 // Called when JS injection for the given frame has been completed. |
105 void OnJsInjectionCompleted( | 102 void OnJsInjectionCompleted(const std::vector<v8::Local<v8::Value>>& results); |
106 const blink::WebVector<v8::Local<v8::Value> >& results); | |
107 | 103 |
108 // Inject any CSS source into the frame for the injection. | 104 // Inject any CSS source into the frame for the injection. |
109 void InjectCss(std::set<std::string>* injected_stylesheets, | 105 void InjectCss(std::set<std::string>* injected_stylesheets, |
110 size_t* num_injected_stylesheets); | 106 size_t* num_injected_stylesheets); |
111 | 107 |
112 // Notify that we will not inject, and mark it as acknowledged. | 108 // Notify that we will not inject, and mark it as acknowledged. |
113 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); | 109 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); |
114 | 110 |
115 // The injector for this injection. | 111 // The injector for this injection. |
116 std::unique_ptr<ScriptInjector> injector_; | 112 std::unique_ptr<ScriptInjector> injector_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 std::unique_ptr<FrameWatcher> frame_watcher_; | 144 std::unique_ptr<FrameWatcher> frame_watcher_; |
149 | 145 |
150 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; | 146 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; |
151 | 147 |
152 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); | 148 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); |
153 }; | 149 }; |
154 | 150 |
155 } // namespace extensions | 151 } // namespace extensions |
156 | 152 |
157 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ | 153 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ |
OLD | NEW |