summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/user_script_master.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/user_script_master.cc')
-rw-r--r--chrome/browser/extensions/user_script_master.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 608f9db..c651c2e 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -306,6 +306,8 @@ UserScriptMaster::UserScriptMaster(const FilePath& script_dir, Profile* profile)
Source<Profile>(profile_));
registrar_.Add(this, NotificationType::EXTENSION_UNLOADED,
Source<Profile>(profile_));
+ registrar_.Add(this, NotificationType::EXTENSION_USER_SCRIPTS_UPDATED,
+ Source<Profile>(profile_));
}
UserScriptMaster::~UserScriptMaster() {
@@ -348,11 +350,14 @@ void UserScriptMaster::Observe(NotificationType type,
Extension* extension = Details<Extension>(details).ptr();
bool incognito_enabled = profile_->GetExtensionsService()->
IsIncognitoEnabled(extension);
+ bool allow_file_access = profile_->GetExtensionsService()->
+ AllowFileAccess(extension);
const UserScriptList& scripts = extension->content_scripts();
for (UserScriptList::const_iterator iter = scripts.begin();
iter != scripts.end(); ++iter) {
lone_scripts_.push_back(*iter);
lone_scripts_.back().set_incognito_enabled(incognito_enabled);
+ lone_scripts_.back().set_allow_file_access(allow_file_access);
}
if (extensions_service_ready_)
StartScan();
@@ -375,6 +380,23 @@ void UserScriptMaster::Observe(NotificationType type,
break;
}
+ case NotificationType::EXTENSION_USER_SCRIPTS_UPDATED: {
+ Extension* extension = Details<Extension>(details).ptr();
+ UserScriptList new_lone_scripts;
+ bool incognito_enabled = profile_->GetExtensionsService()->
+ IsIncognitoEnabled(extension);
+ bool allow_file_access = profile_->GetExtensionsService()->
+ AllowFileAccess(extension);
+ for (UserScriptList::iterator iter = lone_scripts_.begin();
+ iter != lone_scripts_.end(); ++iter) {
+ if (iter->extension_id() == extension->id()) {
+ iter->set_incognito_enabled(incognito_enabled);
+ iter->set_allow_file_access(allow_file_access);
+ }
+ }
+ StartScan();
+ break;
+ }
default:
DCHECK(false);