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::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(std::set<std::string>* injected_stylesheets, |
| 110 size_t* num_injected_stylesheets); |
109 | 111 |
110 // Notify that we will not inject, and mark it as acknowledged. | 112 // Notify that we will not inject, and mark it as acknowledged. |
111 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); | 113 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); |
112 | 114 |
113 // The injector for this injection. | 115 // The injector for this injection. |
114 std::unique_ptr<ScriptInjector> injector_; | 116 std::unique_ptr<ScriptInjector> injector_; |
115 | 117 |
116 // The RenderFrame into which this should inject the script. | 118 // The RenderFrame into which this should inject the script. |
117 content::RenderFrame* render_frame_; | 119 content::RenderFrame* render_frame_; |
118 | 120 |
(...skipping 27 matching lines...) Expand all Loading... |
146 std::unique_ptr<FrameWatcher> frame_watcher_; | 148 std::unique_ptr<FrameWatcher> frame_watcher_; |
147 | 149 |
148 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; | 150 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; |
149 | 151 |
150 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); | 152 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); |
151 }; | 153 }; |
152 | 154 |
153 } // namespace extensions | 155 } // namespace extensions |
154 | 156 |
155 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ | 157 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ |
OLD | NEW |