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

Unified Diff: extensions/renderer/user_script_set_manager.cc

Issue 959413003: Implement <webview>.addContentScript/removeContentScript API [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments. Created 5 years, 9 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/renderer/user_script_set_manager.cc
diff --git a/extensions/renderer/user_script_set_manager.cc b/extensions/renderer/user_script_set_manager.cc
index fee2f724977c988002cee1ef85597d9e8e2998f8..9d7c23f4d6d1a874b6eb0aa26221566291102581 100644
--- a/extensions/renderer/user_script_set_manager.cc
+++ b/extensions/renderer/user_script_set_manager.cc
@@ -17,7 +17,9 @@
namespace extensions {
UserScriptSetManager::UserScriptSetManager(const ExtensionSet* extensions)
- : static_scripts_(extensions), extensions_(extensions) {
+ : static_scripts_(extensions),
+ is_in_guest_render_process_(false),
+ extensions_(extensions) {
content::RenderThread::Get()->AddObserver(this);
}
@@ -67,11 +69,13 @@ void UserScriptSetManager::GetAllInjections(
blink::WebFrame* web_frame,
int tab_id,
UserScript::RunLocation run_location) {
- static_scripts_.GetInjections(injections, web_frame, tab_id, run_location);
+ static_scripts_.GetInjections(injections, web_frame, tab_id, run_location,
+ is_in_guest_render_process_);
for (UserScriptSetMap::iterator it = programmatic_scripts_.begin();
it != programmatic_scripts_.end();
++it) {
- it->second->GetInjections(injections, web_frame, tab_id, run_location);
+ it->second->GetInjections(injections, web_frame, tab_id, run_location,
+ is_in_guest_render_process_);
}
}
@@ -95,7 +99,10 @@ UserScriptSet* UserScriptSetManager::GetProgrammaticScriptsByHostID(
void UserScriptSetManager::OnUpdateUserScripts(
base::SharedMemoryHandle shared_memory,
const HostID& host_id,
- const std::set<HostID>& changed_hosts) {
+ const std::set<HostID>& changed_hosts,
+ bool is_to_guest_render_process) {
+ is_in_guest_render_process_ = is_to_guest_render_process;
+
if (!base::SharedMemory::IsHandleValid(shared_memory)) {
NOTREACHED() << "Bad scripts handle";
return;

Powered by Google App Engine
This is Rietveld 408576698