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_PROGRAMMATIC_SCRIPT_INJECTOR_H_ | 5 #ifndef EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ |
6 #define EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ | 6 #define EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "extensions/renderer/script_injection.h" | 10 #include "extensions/renderer/script_injection.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // A ScriptInjector to handle tabs.executeScript(). | 26 // A ScriptInjector to handle tabs.executeScript(). |
27 class ProgrammaticScriptInjector : public ScriptInjector { | 27 class ProgrammaticScriptInjector : public ScriptInjector { |
28 public: | 28 public: |
29 ProgrammaticScriptInjector(const ExtensionMsg_ExecuteCode_Params& params, | 29 ProgrammaticScriptInjector(const ExtensionMsg_ExecuteCode_Params& params, |
30 blink::WebFrame* web_frame); | 30 blink::WebFrame* web_frame); |
31 virtual ~ProgrammaticScriptInjector(); | 31 virtual ~ProgrammaticScriptInjector(); |
32 | 32 |
33 private: | 33 private: |
34 // ScriptInjector implementation. | 34 // ScriptInjector implementation. |
35 virtual UserScript::InjectionType script_type() const OVERRIDE; | 35 virtual UserScript::InjectionType script_type() const override; |
36 virtual bool ShouldExecuteInChildFrames() const OVERRIDE; | 36 virtual bool ShouldExecuteInChildFrames() const override; |
37 virtual bool ShouldExecuteInMainWorld() const OVERRIDE; | 37 virtual bool ShouldExecuteInMainWorld() const override; |
38 virtual bool IsUserGesture() const OVERRIDE; | 38 virtual bool IsUserGesture() const override; |
39 virtual bool ExpectsResults() const OVERRIDE; | 39 virtual bool ExpectsResults() const override; |
40 virtual bool ShouldInjectJs( | 40 virtual bool ShouldInjectJs( |
41 UserScript::RunLocation run_location) const OVERRIDE; | 41 UserScript::RunLocation run_location) const override; |
42 virtual bool ShouldInjectCss( | 42 virtual bool ShouldInjectCss( |
43 UserScript::RunLocation run_location) const OVERRIDE; | 43 UserScript::RunLocation run_location) const override; |
44 virtual PermissionsData::AccessType CanExecuteOnFrame( | 44 virtual PermissionsData::AccessType CanExecuteOnFrame( |
45 const Extension* extension, | 45 const Extension* extension, |
46 blink::WebFrame* web_frame, | 46 blink::WebFrame* web_frame, |
47 int tab_id, | 47 int tab_id, |
48 const GURL& top_url) const OVERRIDE; | 48 const GURL& top_url) const override; |
49 virtual std::vector<blink::WebScriptSource> GetJsSources( | 49 virtual std::vector<blink::WebScriptSource> GetJsSources( |
50 UserScript::RunLocation run_location) const OVERRIDE; | 50 UserScript::RunLocation run_location) const override; |
51 virtual std::vector<std::string> GetCssSources( | 51 virtual std::vector<std::string> GetCssSources( |
52 UserScript::RunLocation run_location) const OVERRIDE; | 52 UserScript::RunLocation run_location) const override; |
53 virtual void OnInjectionComplete( | 53 virtual void OnInjectionComplete( |
54 scoped_ptr<base::ListValue> execution_results, | 54 scoped_ptr<base::ListValue> execution_results, |
55 ScriptsRunInfo* scripts_run_info, | 55 ScriptsRunInfo* scripts_run_info, |
56 UserScript::RunLocation run_location) OVERRIDE; | 56 UserScript::RunLocation run_location) override; |
57 virtual void OnWillNotInject(InjectFailureReason reason) OVERRIDE; | 57 virtual void OnWillNotInject(InjectFailureReason reason) override; |
58 | 58 |
59 // Return the run location for this injector. | 59 // Return the run location for this injector. |
60 UserScript::RunLocation GetRunLocation() const; | 60 UserScript::RunLocation GetRunLocation() const; |
61 | 61 |
62 // Notify the browser that the script was injected (or never will be), and | 62 // Notify the browser that the script was injected (or never will be), and |
63 // send along any results or errors. | 63 // send along any results or errors. |
64 void Finish(const std::string& error); | 64 void Finish(const std::string& error); |
65 | 65 |
66 // The parameters for injecting the script. | 66 // The parameters for injecting the script. |
67 scoped_ptr<ExtensionMsg_ExecuteCode_Params> params_; | 67 scoped_ptr<ExtensionMsg_ExecuteCode_Params> params_; |
68 | 68 |
69 // The url of the frame into which we are injecting. | 69 // The url of the frame into which we are injecting. |
70 GURL url_; | 70 GURL url_; |
71 | 71 |
72 // The RenderView to which we send the response upon completion. | 72 // The RenderView to which we send the response upon completion. |
73 content::RenderView* render_view_; | 73 content::RenderView* render_view_; |
74 | 74 |
75 // The results of the script execution. | 75 // The results of the script execution. |
76 scoped_ptr<base::ListValue> results_; | 76 scoped_ptr<base::ListValue> results_; |
77 | 77 |
78 // Whether or not this script injection has finished. | 78 // Whether or not this script injection has finished. |
79 bool finished_; | 79 bool finished_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); | 81 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace extensions | 84 } // namespace extensions |
85 | 85 |
86 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ | 86 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ |
OLD | NEW |