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

Unified Diff: chrome/renderer/user_script_slave.cc

Issue 19624: Add early-injection capability to user scripts. I haven't yet (Closed)
Patch Set: Use new documentElementAvailable() callback Created 11 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/user_script_slave.cc
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index 9db7e681e358883a66bb88231b6d41d58d842ae9..083ea7fd9e0deffa4a63f00ced12283b63c7c6b0 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -87,10 +87,12 @@ bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory) {
return true;
}
-bool UserScriptSlave::InjectScripts(WebFrame* frame) {
+bool UserScriptSlave::InjectScripts(WebFrame* frame,
+ UserScript::RunLocation location) {
for (std::vector<UserScript*>::iterator script = scripts_.begin();
script != scripts_.end(); ++script) {
- if ((*script)->MatchesUrl(frame->GetURL())) {
+ if ((*script)->MatchesUrl(frame->GetURL()) &&
+ (*script)->run_location() == location) {
std::string inject(kUserScriptHead);
inject.append(api_js_.as_string());
inject.append(script_contents_[*script].as_string());

Powered by Google App Engine
This is Rietveld 408576698