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

Unified Diff: chrome/browser/extensions/user_script_loader.cc

Issue 906493004: Refactoring: de-couple Extensions from "script injection System" [render side]:2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_1
Patch Set: Rebase. Created 5 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
« no previous file with comments | « no previous file | extensions/common/consumer_instance_info.h » ('j') | extensions/common/user_script.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_loader.cc
diff --git a/chrome/browser/extensions/user_script_loader.cc b/chrome/browser/extensions/user_script_loader.cc
index 24e042ba48284f2202405c3f71331797f9392ce4..454bf74bd3a940bc700b24bc435584dd9efb1da7 100644
--- a/chrome/browser/extensions/user_script_loader.cc
+++ b/chrome/browser/extensions/user_script_loader.cc
@@ -441,10 +441,32 @@ void UserScriptLoader::OnScriptsLoaded(
// We've got scripts ready to go.
shared_memory_.reset(shared_memory.release());
+ // If user scripts are comming from a <webview>, will only notify the
+ // RenderProcessHost of that <webview>; otherwise will notify all of the
+ // RenderProcessHosts.
+ bool is_web_view = false;
+ int render_process_id = -1;
+ const UserScriptList* scripts = user_scripts.get();
+ if (scripts && !scripts->empty() &&
+ (*scripts)[0].consumer_instance_info().type() ==
+ ConsumerInstanceInfo::WEBVIEW) {
+ DCHECK(scripts->size() == 1);
+ is_web_view = true;
+ render_process_id = (*scripts)[0].routing_info().render_process_id;
+ }
+
for (content::RenderProcessHost::iterator i(
content::RenderProcessHost::AllHostsIterator());
!i.IsAtEnd();
i.Advance()) {
+ if (is_web_view) {
+ if (i.GetCurrentValue()->GetID() != render_process_id) {
Fady Samuel 2015/02/11 19:08:22 if (is_web_view && i.GetCurrentValue()->GetID() !=
+ continue;
+ } else {
Fady Samuel 2015/02/11 19:08:22 Not necessary.
Xi Han 2015/02/11 21:57:24 I add the else for early break (line 467 "break").
Xi Han 2015/02/11 22:06:57 Adopt Fady's suggestion.
+ SendUpdate(i.GetCurrentValue(), shared_memory_.get(), changed_hosts_);
+ break;
+ }
+ }
SendUpdate(i.GetCurrentValue(), shared_memory_.get(), changed_hosts_);
}
changed_hosts_.clear();
« no previous file with comments | « no previous file | extensions/common/consumer_instance_info.h » ('j') | extensions/common/user_script.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698