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

Unified Diff: chrome/renderer/user_script_slave.cc

Issue 567037: Initial work on making extensions work in incognito mode. (Closed)
Patch Set: added experimental requirement Created 10 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 a06d856176bd4c614a186c7bcbb83d9ee11c7fcd..0c0574bde40bed01380bba124978ef54b0302524 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -68,7 +68,8 @@ void UserScriptSlave::GetActiveExtensions(std::set<std::string>* extension_ids)
}
}
-bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory) {
+bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory,
+ bool only_inject_incognito) {
scripts_.clear();
// Create the shared memory object (read only).
@@ -101,6 +102,13 @@ bool UserScriptSlave::UpdateScripts(base::SharedMemoryHandle shared_memory) {
UserScript* script = scripts_.back();
script->Unpickle(pickle, &iter);
+ if (only_inject_incognito && !script->is_incognito_enabled()) {
+ // This script shouldn't run in an incognito tab.
+ delete script;
+ scripts_.pop_back();
+ continue;
+ }
+
// Note that this is a pointer into shared memory. We don't own it. It gets
// cleared up when the last renderer or browser process drops their
// reference to the shared memory.
« no previous file with comments | « chrome/renderer/user_script_slave.h ('k') | chrome/test/data/extensions/api_test/browser_action/add_popup/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698