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

Unified Diff: extensions/browser/user_script_loader.cc

Issue 1140173003: Allow whitelisted content scripts to be injected in WebViews. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@document_has_focus
Patch Set: Don't assume extensions_->GetByID will succeed Created 5 years, 7 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: extensions/browser/user_script_loader.cc
diff --git a/extensions/browser/user_script_loader.cc b/extensions/browser/user_script_loader.cc
index 7daf95d22fe367431d9002748da60ff7b3245439..44070930e946f53224b0557c3030fdcde4ec58c6 100644
--- a/extensions/browser/user_script_loader.cc
+++ b/extensions/browser/user_script_loader.cc
@@ -378,9 +378,9 @@ void UserScriptLoader::OnScriptsLoaded(
void UserScriptLoader::SendUpdate(content::RenderProcessHost* process,
base::SharedMemory* shared_memory,
const std::set<HostID>& changed_hosts) {
- // Don't allow injection of extensions' content scripts into <webview>.
- if (process->IsIsolatedGuest() && host_id().id().empty())
- return;
+ // Don't allow injection of non-whitelisted extensions' content scripts
+ // into <webview>.
+ bool whitelisted_only = process->IsIsolatedGuest() && host_id().id().empty();
// Make sure we only send user scripts to processes in our browser_context.
if (!ExtensionsBrowserClient::Get()->IsSameContext(
@@ -398,8 +398,8 @@ void UserScriptLoader::SendUpdate(content::RenderProcessHost* process,
return; // This can legitimately fail if the renderer asserts at startup.
if (base::SharedMemory::IsHandleValid(handle_for_process)) {
- process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process,
- host_id(), changed_hosts));
+ process->Send(new ExtensionMsg_UpdateUserScripts(
+ handle_for_process, host_id(), changed_hosts, whitelisted_only));
}
}
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest_delegate.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698