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 #include "extensions/renderer/programmatic_script_injector.h" | 5 #include "extensions/renderer/programmatic_script_injector.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 DCHECK_EQ(injection_host->id().type(), HostID::EXTENSIONS); | 87 DCHECK_EQ(injection_host->id().type(), HostID::EXTENSIONS); |
88 | 88 |
89 return injection_host->CanExecuteOnFrame( | 89 return injection_host->CanExecuteOnFrame( |
90 effective_document_url, | 90 effective_document_url, |
91 content::RenderFrame::FromWebFrame(frame), | 91 content::RenderFrame::FromWebFrame(frame), |
92 tab_id, | 92 tab_id, |
93 true /* is_declarative */); | 93 true /* is_declarative */); |
94 } | 94 } |
95 | 95 |
96 std::vector<blink::WebScriptSource> ProgrammaticScriptInjector::GetJsSources( | 96 std::vector<blink::WebScriptSource> ProgrammaticScriptInjector::GetJsSources( |
97 UserScript::RunLocation run_location, | 97 UserScript::RunLocation run_location) const { |
98 ScriptsRunInfo* scripts_run_info) const { | |
99 DCHECK_EQ(GetRunLocation(), run_location); | 98 DCHECK_EQ(GetRunLocation(), run_location); |
100 DCHECK(params_->is_javascript); | 99 DCHECK(params_->is_javascript); |
101 | 100 |
102 return std::vector<blink::WebScriptSource>( | 101 return std::vector<blink::WebScriptSource>( |
103 1, | 102 1, |
104 blink::WebScriptSource( | 103 blink::WebScriptSource( |
105 blink::WebString::fromUTF8(params_->code), params_->file_url)); | 104 blink::WebString::fromUTF8(params_->code), params_->file_url)); |
106 } | 105 } |
107 | 106 |
108 std::vector<std::string> ProgrammaticScriptInjector::GetCssSources( | 107 std::vector<std::string> ProgrammaticScriptInjector::GetCssSources( |
109 UserScript::RunLocation run_location, | 108 UserScript::RunLocation run_location) const { |
110 ScriptsRunInfo* scripts_run_info) const { | |
111 DCHECK_EQ(GetRunLocation(), run_location); | 109 DCHECK_EQ(GetRunLocation(), run_location); |
112 DCHECK(!params_->is_javascript); | 110 DCHECK(!params_->is_javascript); |
113 | 111 |
114 return std::vector<std::string>(1, params_->code); | 112 return std::vector<std::string>(1, params_->code); |
115 } | 113 } |
116 | 114 |
117 void ProgrammaticScriptInjector::GetRunInfo( | 115 void ProgrammaticScriptInjector::GetRunInfo( |
118 ScriptsRunInfo* scripts_run_info, | 116 ScriptsRunInfo* scripts_run_info, |
119 UserScript::RunLocation run_location) const { | 117 UserScript::RunLocation run_location) const { |
120 } | 118 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // frame deletions so nothing is left hanging). | 176 // frame deletions so nothing is left hanging). |
179 if (render_frame) { | 177 if (render_frame) { |
180 render_frame->Send( | 178 render_frame->Send( |
181 new ExtensionHostMsg_ExecuteCodeFinished( | 179 new ExtensionHostMsg_ExecuteCodeFinished( |
182 render_frame->GetRoutingID(), params_->request_id, | 180 render_frame->GetRoutingID(), params_->request_id, |
183 error, url_, results_)); | 181 error, url_, results_)); |
184 } | 182 } |
185 } | 183 } |
186 | 184 |
187 } // namespace extensions | 185 } // namespace extensions |
OLD | NEW |