Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: extensions/renderer/user_script_injector.cc

Issue 2471553003: Fix content script injection not working with PlzNavigate because of different navigation timings. (Closed)
Patch Set: review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/user_script_injector.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/user_script_injector.h" 5 #include "extensions/renderer/user_script_injector.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 UserScript::RunLocation run_location, 157 UserScript::RunLocation run_location,
158 const std::set<std::string>& injected_stylesheets) const { 158 const std::set<std::string>& injected_stylesheets) const {
159 return script_ && run_location == UserScript::DOCUMENT_START && 159 return script_ && run_location == UserScript::DOCUMENT_START &&
160 !script_->css_scripts().empty() && 160 !script_->css_scripts().empty() &&
161 ShouldInjectScripts(script_->css_scripts(), injected_stylesheets); 161 ShouldInjectScripts(script_->css_scripts(), injected_stylesheets);
162 } 162 }
163 163
164 PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame( 164 PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame(
165 const InjectionHost* injection_host, 165 const InjectionHost* injection_host,
166 blink::WebLocalFrame* web_frame, 166 blink::WebLocalFrame* web_frame,
167 int tab_id) const { 167 int tab_id) {
168 // There is no harm in allowing the injection when the script is gone, 168 // There is no harm in allowing the injection when the script is gone,
169 // because there is nothing to inject. 169 // because there is nothing to inject.
170 if (!script_) 170 if (!script_)
171 return PermissionsData::ACCESS_ALLOWED; 171 return PermissionsData::ACCESS_ALLOWED;
172 172
173 if (script_->consumer_instance_type() == 173 if (script_->consumer_instance_type() ==
174 UserScript::ConsumerInstanceType::WEBVIEW) { 174 UserScript::ConsumerInstanceType::WEBVIEW) {
175 int routing_id = content::RenderView::FromWebView(web_frame->top()->view()) 175 int routing_id = content::RenderView::FromWebView(web_frame->top()->view())
176 ->GetRoutingID(); 176 ->GetRoutingID();
177 177
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 void UserScriptInjector::OnInjectionComplete( 268 void UserScriptInjector::OnInjectionComplete(
269 std::unique_ptr<base::Value> execution_result, 269 std::unique_ptr<base::Value> execution_result,
270 UserScript::RunLocation run_location, 270 UserScript::RunLocation run_location,
271 content::RenderFrame* render_frame) {} 271 content::RenderFrame* render_frame) {}
272 272
273 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason, 273 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason,
274 content::RenderFrame* render_frame) { 274 content::RenderFrame* render_frame) {
275 } 275 }
276 276
277 } // namespace extensions 277 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/user_script_injector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698