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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "extensions/common/user_script.h" | 10 #include "extensions/common/user_script.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Returns true if the injection ran. | 50 // Returns true if the injection ran. |
51 bool OnPermissionGranted(const InjectionHost* injection_host, | 51 bool OnPermissionGranted(const InjectionHost* injection_host, |
52 ScriptsRunInfo* scripts_run_info); | 52 ScriptsRunInfo* scripts_run_info); |
53 | 53 |
54 // Accessors. | 54 // Accessors. |
55 blink::WebLocalFrame* web_frame() const { return web_frame_; } | 55 blink::WebLocalFrame* web_frame() const { return web_frame_; } |
56 const HostID& host_id() const { return host_id_; } | 56 const HostID& host_id() const { return host_id_; } |
57 int64 request_id() const { return request_id_; } | 57 int64 request_id() const { return request_id_; } |
58 | 58 |
59 private: | 59 private: |
60 // Send a message to the browser requesting permission to execute. | 60 // Sends a message to the browser, either that the script injection would |
61 void RequestPermission(); | 61 // like to inject, or to notify the browser that it is currently injecting. |
| 62 void SendInjectionMessage(bool request_permission); |
62 | 63 |
63 // Injects the script, optionally populating |scripts_run_info|. | 64 // Injects the script, optionally populating |scripts_run_info|. |
64 void Inject(const InjectionHost* injection_host, | 65 void Inject(const InjectionHost* injection_host, |
65 ScriptsRunInfo* scripts_run_info); | 66 ScriptsRunInfo* scripts_run_info); |
66 | 67 |
67 // Inject any JS scripts into the |frame|, optionally populating | 68 // Inject any JS scripts into the |frame|, optionally populating |
68 // |execution_results|. | 69 // |execution_results|. |
69 void InjectJs(const InjectionHost* injection_host, | 70 void InjectJs(const InjectionHost* injection_host, |
70 blink::WebLocalFrame* frame, | 71 blink::WebLocalFrame* frame, |
71 base::ListValue* execution_results); | 72 base::ListValue* execution_results); |
(...skipping 26 matching lines...) Expand all Loading... |
98 // Whether or not the injection is complete, either via injecting the script | 99 // Whether or not the injection is complete, either via injecting the script |
99 // or because it will never complete. | 100 // or because it will never complete. |
100 bool complete_; | 101 bool complete_; |
101 | 102 |
102 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); | 103 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace extensions | 106 } // namespace extensions |
106 | 107 |
107 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ | 108 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ |
OLD | NEW |