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 <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/values.h" | 11 #include "base/values.h" |
11 #include "extensions/renderer/script_injection.h" | 12 #include "extensions/renderer/script_injection.h" |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
14 struct ExtensionMsg_ExecuteCode_Params; | 15 struct ExtensionMsg_ExecuteCode_Params; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class RenderFrame; | 18 class RenderFrame; |
18 } | 19 } |
19 | 20 |
(...skipping 17 matching lines...) Expand all Loading... |
37 PermissionsData::AccessType CanExecuteOnFrame( | 38 PermissionsData::AccessType CanExecuteOnFrame( |
38 const InjectionHost* injection_host, | 39 const InjectionHost* injection_host, |
39 blink::WebLocalFrame* web_frame, | 40 blink::WebLocalFrame* web_frame, |
40 int tab_id) const override; | 41 int tab_id) const override; |
41 std::vector<blink::WebScriptSource> GetJsSources( | 42 std::vector<blink::WebScriptSource> GetJsSources( |
42 UserScript::RunLocation run_location) const override; | 43 UserScript::RunLocation run_location) const override; |
43 std::vector<std::string> GetCssSources( | 44 std::vector<std::string> GetCssSources( |
44 UserScript::RunLocation run_location) const override; | 45 UserScript::RunLocation run_location) const override; |
45 void GetRunInfo(ScriptsRunInfo* scripts_run_info, | 46 void GetRunInfo(ScriptsRunInfo* scripts_run_info, |
46 UserScript::RunLocation run_location) const override; | 47 UserScript::RunLocation run_location) const override; |
47 void OnInjectionComplete(scoped_ptr<base::Value> execution_result, | 48 void OnInjectionComplete(std::unique_ptr<base::Value> execution_result, |
48 UserScript::RunLocation run_location, | 49 UserScript::RunLocation run_location, |
49 content::RenderFrame* render_frame) override; | 50 content::RenderFrame* render_frame) override; |
50 void OnWillNotInject(InjectFailureReason reason, | 51 void OnWillNotInject(InjectFailureReason reason, |
51 content::RenderFrame* render_frame) override; | 52 content::RenderFrame* render_frame) override; |
52 | 53 |
53 // Whether it is safe to include information about the URL in error messages. | 54 // Whether it is safe to include information about the URL in error messages. |
54 bool CanShowUrlInError() const; | 55 bool CanShowUrlInError() const; |
55 | 56 |
56 // Return the run location for this injector. | 57 // Return the run location for this injector. |
57 UserScript::RunLocation GetRunLocation() const; | 58 UserScript::RunLocation GetRunLocation() const; |
58 | 59 |
59 // Notify the browser that the script was injected (or never will be), and | 60 // Notify the browser that the script was injected (or never will be), and |
60 // send along any results or errors. | 61 // send along any results or errors. |
61 void Finish(const std::string& error, content::RenderFrame* render_frame); | 62 void Finish(const std::string& error, content::RenderFrame* render_frame); |
62 | 63 |
63 // The parameters for injecting the script. | 64 // The parameters for injecting the script. |
64 scoped_ptr<ExtensionMsg_ExecuteCode_Params> params_; | 65 std::unique_ptr<ExtensionMsg_ExecuteCode_Params> params_; |
65 | 66 |
66 // The url of the frame into which we are injecting. | 67 // The url of the frame into which we are injecting. |
67 GURL url_; | 68 GURL url_; |
68 | 69 |
69 // The serialization of the frame's origin if the frame is an about:-URL. This | 70 // The serialization of the frame's origin if the frame is an about:-URL. This |
70 // is used to provide user-friendly messages. | 71 // is used to provide user-friendly messages. |
71 std::string origin_for_about_error_; | 72 std::string origin_for_about_error_; |
72 | 73 |
73 // The results of the script execution. | 74 // The results of the script execution. |
74 base::ListValue results_; | 75 base::ListValue results_; |
75 | 76 |
76 // Whether or not this script injection has finished. | 77 // Whether or not this script injection has finished. |
77 bool finished_; | 78 bool finished_; |
78 | 79 |
79 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); | 80 DISALLOW_COPY_AND_ASSIGN(ProgrammaticScriptInjector); |
80 }; | 81 }; |
81 | 82 |
82 } // namespace extensions | 83 } // namespace extensions |
83 | 84 |
84 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ | 85 #endif // EXTENSIONS_RENDERER_PROGRAMMATIC_SCRIPT_INJECTOR_H_ |
OLD | NEW |