Chromium Code Reviews| Index: chrome/browser/extensions/permissions_updater.cc |
| diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc |
| index 5f2f62981d5889f7db19804d7734561aaaac5b9f..2333b14f59d76ab26c5c84f78e183430273fc83e 100644 |
| --- a/chrome/browser/extensions/permissions_updater.cc |
| +++ b/chrome/browser/extensions/permissions_updater.cc |
| @@ -186,6 +186,7 @@ void PermissionsUpdater::InitializePermissions(const Extension* extension) { |
| withheld_explicit_hosts, |
| withheld_scriptable_hosts); |
| SetPermissions(extension, bounded_active, withheld); |
| + ActivateGrantedHosts(extension); |
|
gpdavis
2014/08/07 20:50:39
Once we're done initializing permissions (we use B
|
| } |
| void PermissionsUpdater::WithholdImpliedAllHosts(const Extension* extension) { |
| @@ -250,6 +251,40 @@ void PermissionsUpdater::GrantWithheldImpliedAllHosts( |
| // TODO(rdevlin.cronin) We should notify the observers/renderer. |
| } |
| +void PermissionsUpdater::ActivateGrantedHosts( |
| + const Extension* extension) { |
| + scoped_refptr<const PermissionSet> active = |
| + extension->permissions_data()->active_permissions(); |
| + scoped_refptr<const PermissionSet> withheld = |
| + extension->permissions_data()->withheld_permissions(); |
| + |
| + PermissionSet* granted = ExtensionPrefs::Get(browser_context_) |
| + ->GetGrantedPermissions(extension->id()); |
| + URLPatternSet new_explicit_hosts(active->explicit_hosts()); |
| + URLPatternSet new_scriptable_hosts(active->scriptable_hosts()); |
| + |
| + for (URLPatternSet::const_iterator iter = granted->explicit_hosts().begin(); |
| + iter != granted->explicit_hosts().end(); |
| + ++iter) { |
| + if (!iter->ImpliesAllHosts()) |
| + new_explicit_hosts.AddPattern(*iter); |
| + } |
| + |
| + for (URLPatternSet::const_iterator iter = granted->scriptable_hosts().begin(); |
| + iter != granted->scriptable_hosts().end(); |
| + ++iter) { |
| + if (!iter->ImpliesAllHosts()) |
| + new_scriptable_hosts.AddPattern(*iter); |
| + } |
| + |
| + SetPermissions(extension, |
| + new PermissionSet(active->apis(), |
| + active->manifest_permissions(), |
| + new_explicit_hosts, |
| + new_scriptable_hosts), |
| + withheld); |
|
gpdavis
2014/08/07 20:50:39
... ActivateGrantedHosts will crawl through the gr
|
| +} |
| + |
| void PermissionsUpdater::SetPermissions( |
| const Extension* extension, |
| const scoped_refptr<const PermissionSet>& active, |