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

Unified Diff: chrome/browser/extensions/permissions_updater.cc

Issue 939803002: [Extensions] Update renderers when all-urls is granted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 5 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
« no previous file with comments | « chrome/browser/extensions/active_script_controller_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/permissions_updater.cc
diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc
index 953b25c0e24e34eded32f5c61c2c12d6c183e2a2..f902df455bb09e2961ced758a8e1e79e0b8535e3 100644
--- a/chrome/browser/extensions/permissions_updater.cc
+++ b/chrome/browser/extensions/permissions_updater.cc
@@ -253,16 +253,29 @@ void PermissionsUpdater::WithholdImpliedAllHosts(const Extension* extension) {
&active_explicit,
&withheld_explicit);
+ URLPatternSet delta_explicit;
+ URLPatternSet::CreateDifference(
+ active->explicit_hosts(), active_explicit, &delta_explicit);
+ URLPatternSet delta_scriptable;
+ URLPatternSet::CreateDifference(
+ active->scriptable_hosts(), active_scriptable, &delta_scriptable);
+
SetPermissions(extension,
new PermissionSet(active->apis(),
active->manifest_permissions(),
active_explicit,
active_scriptable),
- new PermissionSet(withheld->apis(),
- withheld->manifest_permissions(),
- withheld_explicit,
- withheld_scriptable));
- // TODO(rdevlin.cronin) We should notify the observers/renderer.
+ new PermissionSet(withheld->apis(),
+ withheld->manifest_permissions(),
+ withheld_explicit,
+ withheld_scriptable));
+
+ scoped_refptr<const PermissionSet> delta(new PermissionSet(
+ APIPermissionSet(),
+ ManifestPermissionSet(),
+ delta_explicit,
+ delta_scriptable));
+ NotifyPermissionsUpdated(REMOVED, extension, delta.get());
}
void PermissionsUpdater::GrantWithheldImpliedAllHosts(
@@ -284,6 +297,13 @@ void PermissionsUpdater::GrantWithheldImpliedAllHosts(
withheld->scriptable_hosts(),
&scriptable_hosts);
+ URLPatternSet delta_explicit;
+ URLPatternSet::CreateDifference(
+ explicit_hosts, active->explicit_hosts(), &delta_explicit);
+ URLPatternSet delta_scriptable;
+ URLPatternSet::CreateDifference(
+ scriptable_hosts, active->scriptable_hosts(), &delta_scriptable);
+
// Since we only withhold host permissions (so far), we know that withheld
// permissions will be empty.
SetPermissions(extension,
@@ -292,7 +312,13 @@ void PermissionsUpdater::GrantWithheldImpliedAllHosts(
explicit_hosts,
scriptable_hosts),
new PermissionSet());
- // TODO(rdevlin.cronin) We should notify the observers/renderer.
+
+ scoped_refptr<const PermissionSet> delta(new PermissionSet(
+ APIPermissionSet(),
+ ManifestPermissionSet(),
+ delta_explicit,
+ delta_scriptable));
+ NotifyPermissionsUpdated(ADDED, extension, delta.get());
}
void PermissionsUpdater::SetPermissions(
« no previous file with comments | « chrome/browser/extensions/active_script_controller_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698