| 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_INJECTOR_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTOR_H_ |
| 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTOR_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // Returns true if the script should inject CSS at the given |run_location|. | 58 // Returns true if the script should inject CSS at the given |run_location|. |
| 59 virtual bool ShouldInjectCss( | 59 virtual bool ShouldInjectCss( |
| 60 UserScript::RunLocation run_location, | 60 UserScript::RunLocation run_location, |
| 61 const std::set<std::string>& injected_stylesheets) const = 0; | 61 const std::set<std::string>& injected_stylesheets) const = 0; |
| 62 | 62 |
| 63 // Returns true if the script should execute on the given |frame|. | 63 // Returns true if the script should execute on the given |frame|. |
| 64 virtual PermissionsData::AccessType CanExecuteOnFrame( | 64 virtual PermissionsData::AccessType CanExecuteOnFrame( |
| 65 const InjectionHost* injection_host, | 65 const InjectionHost* injection_host, |
| 66 blink::WebLocalFrame* web_frame, | 66 blink::WebLocalFrame* web_frame, |
| 67 int tab_id) const = 0; | 67 int tab_id) = 0; |
| 68 | 68 |
| 69 // Returns the javascript sources to inject at the given |run_location|. | 69 // Returns the javascript sources to inject at the given |run_location|. |
| 70 // Only called if ShouldInjectJs() is true. | 70 // Only called if ShouldInjectJs() is true. |
| 71 virtual std::vector<blink::WebScriptSource> GetJsSources( | 71 virtual std::vector<blink::WebScriptSource> GetJsSources( |
| 72 UserScript::RunLocation run_location, | 72 UserScript::RunLocation run_location, |
| 73 std::set<std::string>* executing_scripts, | 73 std::set<std::string>* executing_scripts, |
| 74 size_t* num_injected_js_scripts) const = 0; | 74 size_t* num_injected_js_scripts) const = 0; |
| 75 | 75 |
| 76 // Returns the css to inject at the given |run_location|. | 76 // Returns the css to inject at the given |run_location|. |
| 77 // Only called if ShouldInjectCss() is true. | 77 // Only called if ShouldInjectCss() is true. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 92 // Notifies the script that injection will never occur. | 92 // Notifies the script that injection will never occur. |
| 93 // |render_frame| contains the render frame, or null if the frame was | 93 // |render_frame| contains the render frame, or null if the frame was |
| 94 // invalidated. | 94 // invalidated. |
| 95 virtual void OnWillNotInject(InjectFailureReason reason, | 95 virtual void OnWillNotInject(InjectFailureReason reason, |
| 96 content::RenderFrame* render_frame) = 0; | 96 content::RenderFrame* render_frame) = 0; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace extensions | 99 } // namespace extensions |
| 100 | 100 |
| 101 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTOR_H_ | 101 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTOR_H_ |
| OLD | NEW |