| 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..414bdbc9c69fbbd7c532b383125e60e9052c9db6 100644
|
| --- a/chrome/browser/extensions/permissions_updater.cc
|
| +++ b/chrome/browser/extensions/permissions_updater.cc
|
| @@ -144,9 +144,9 @@ void PermissionsUpdater::GrantActivePermissions(const Extension* extension) {
|
| }
|
|
|
| void PermissionsUpdater::InitializePermissions(const Extension* extension) {
|
| + ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_);
|
| scoped_refptr<const PermissionSet> bounded_active =
|
| - GetBoundedActivePermissions(extension,
|
| - ExtensionPrefs::Get(browser_context_));
|
| + GetBoundedActivePermissions(extension, prefs);
|
|
|
| // We withhold permissions iff the switch to do so is enabled, the extension
|
| // shows up in chrome:extensions (so the user can grant withheld permissions),
|
| @@ -175,6 +175,23 @@ void PermissionsUpdater::InitializePermissions(const Extension* extension) {
|
| &granted_scriptable_hosts,
|
| &withheld_scriptable_hosts);
|
|
|
| + // Add persisted permissions to granted hosts.
|
| + PermissionSet* persisted = prefs->GetPersistedPermissions(extension->id());
|
| + if (persisted) {
|
| + const URLPatternSet& explicit_hosts = persisted->explicit_hosts();
|
| + for (URLPatternSet::const_iterator iter = explicit_hosts.begin();
|
| + iter != explicit_hosts.end();
|
| + ++iter) {
|
| + granted_explicit_hosts.AddPattern(*iter);
|
| + }
|
| + const URLPatternSet& scriptable_hosts = persisted->scriptable_hosts();
|
| + for (URLPatternSet::const_iterator iter = scriptable_hosts.begin();
|
| + iter != scriptable_hosts.end();
|
| + ++iter) {
|
| + granted_scriptable_hosts.AddPattern(*iter);
|
| + }
|
| + }
|
| +
|
| bounded_active = new PermissionSet(bounded_active->apis(),
|
| bounded_active->manifest_permissions(),
|
| granted_explicit_hosts,
|
|
|