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(ScriptsRunInfo* scripts_run_info); |
102 | 102 |
103 // Called when JS injection for the given frame has been completed. | 103 // Called when JS injection for the given frame has been completed. |
104 void OnJsInjectionCompleted( | 104 void OnJsInjectionCompleted( |
105 const blink::WebVector<v8::Local<v8::Value> >& results); | 105 const blink::WebVector<v8::Local<v8::Value> >& results); |
106 | 106 |
107 // Inject any CSS source into the frame for the injection. | 107 // Inject any CSS source into the frame for the injection. |
108 void InjectCss(); | 108 void InjectCss(ScriptsRunInfo* scripts_run_info); |
109 | 109 |
110 // Notify that we will not inject, and mark it as acknowledged. | 110 // Notify that we will not inject, and mark it as acknowledged. |
111 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); | 111 void NotifyWillNotInject(ScriptInjector::InjectFailureReason reason); |
112 | 112 |
113 // The injector for this injection. | 113 // The injector for this injection. |
114 std::unique_ptr<ScriptInjector> injector_; | 114 std::unique_ptr<ScriptInjector> injector_; |
115 | 115 |
116 // The RenderFrame into which this should inject the script. | 116 // The RenderFrame into which this should inject the script. |
117 content::RenderFrame* render_frame_; | 117 content::RenderFrame* render_frame_; |
118 | 118 |
(...skipping 27 matching lines...) Expand all Loading... |
146 std::unique_ptr<FrameWatcher> frame_watcher_; | 146 std::unique_ptr<FrameWatcher> frame_watcher_; |
147 | 147 |
148 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; | 148 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); | 150 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); |
151 }; | 151 }; |
152 | 152 |
153 } // namespace extensions | 153 } // namespace extensions |
154 | 154 |
155 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ | 155 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ |
OLD | NEW |