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> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 class FrameWatcher; | 91 class FrameWatcher; |
92 | 92 |
93 // Sends a message to the browser to request permission to inject. | 93 // Sends a message to the browser to request permission to inject. |
94 void RequestPermissionFromBrowser(); | 94 void RequestPermissionFromBrowser(); |
95 | 95 |
96 // Injects the script. Returns INJECTION_FINISHED if injection has finished, | 96 // Injects the script. Returns INJECTION_FINISHED if injection has finished, |
97 // otherwise INJECTION_BLOCKED. | 97 // otherwise INJECTION_BLOCKED. |
98 InjectionResult Inject(ScriptsRunInfo* scripts_run_info); | 98 InjectionResult Inject(ScriptsRunInfo* scripts_run_info); |
99 | 99 |
100 // Inject any JS scripts into the frame for the injection. | 100 // Inject any JS scripts into the frame for the injection. |
101 void InjectJs(); | 101 void InjectJs(std::map<std::string, std::set<std::string>>* executing_scripts, |
| 102 size_t* num_injected_js_scripts); |
102 | 103 |
103 // Called when JS injection for the given frame has been completed. | 104 // Called when JS injection for the given frame has been completed. |
104 void OnJsInjectionCompleted( | 105 void OnJsInjectionCompleted( |
105 const blink::WebVector<v8::Local<v8::Value> >& results); | 106 const blink::WebVector<v8::Local<v8::Value> >& results); |
106 | 107 |
107 // Inject any CSS source into the frame for the injection. | 108 // Inject any CSS source into the frame for the injection. |
108 void InjectCss(); | 109 void InjectCss( |
| 110 std::map<std::string, std::set<std::string>>* executing_scripts, |
| 111 size_t* num_injected_css_scripts); |
109 | 112 |
110 // Notify that we will not inject, and mark it as acknowledged. | 113 // Notify that we will not inject, and mark it as acknowledged. |
111 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); | 114 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); |
112 | 115 |
113 // The injector for this injection. | 116 // The injector for this injection. |
114 std::unique_ptr<ScriptInjector> injector_; | 117 std::unique_ptr<ScriptInjector> injector_; |
115 | 118 |
116 // The RenderFrame into which this should inject the script. | 119 // The RenderFrame into which this should inject the script. |
117 content::RenderFrame* render_frame_; | 120 content::RenderFrame* render_frame_; |
118 | 121 |
(...skipping 27 matching lines...) Expand all Loading... |
146 std::unique_ptr<FrameWatcher> frame_watcher_; | 149 std::unique_ptr<FrameWatcher> frame_watcher_; |
147 | 150 |
148 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; | 151 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; |
149 | 152 |
150 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); | 153 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); |
151 }; | 154 }; |
152 | 155 |
153 } // namespace extensions | 156 } // namespace extensions |
154 | 157 |
155 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ | 158 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ |
OLD | NEW |