| Index: chrome/browser/extensions/permissions_updater.cc
|
| diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc
|
| index 26730a999aaa4510a01500c6c3bab92db4b18f12..a26f0eaa0e42dc6b0222688c7689d7ec748db184 100644
|
| --- a/chrome/browser/extensions/permissions_updater.cc
|
| +++ b/chrome/browser/extensions/permissions_updater.cc
|
| @@ -69,6 +69,8 @@ std::unique_ptr<const PermissionSet> GetBoundedActivePermissions(
|
| return adjusted_active;
|
| }
|
|
|
| +PermissionsUpdater::Delegate* g_delegate = nullptr;
|
| +
|
| } // namespace
|
|
|
| PermissionsUpdater::PermissionsUpdater(content::BrowserContext* browser_context)
|
| @@ -82,6 +84,14 @@ PermissionsUpdater::PermissionsUpdater(content::BrowserContext* browser_context,
|
|
|
| PermissionsUpdater::~PermissionsUpdater() {}
|
|
|
| +// static
|
| +void PermissionsUpdater::SetPlatformDelegate(Delegate* delegate) {
|
| + // Make sure we're setting it only once (allow setting to nullptr, but then
|
| + // take special care of actually freeing it).
|
| + CHECK(!g_delegate || !delegate);
|
| + g_delegate = delegate;
|
| +}
|
| +
|
| void PermissionsUpdater::AddPermissions(const Extension* extension,
|
| const PermissionSet& permissions) {
|
| const PermissionSet& active =
|
| @@ -197,6 +207,9 @@ void PermissionsUpdater::InitializePermissions(const Extension* extension) {
|
| &withheld_permissions,
|
| (init_flag_ & INIT_FLAG_TRANSIENT) != 0);
|
|
|
| + if (g_delegate)
|
| + g_delegate->InitializePermissions(extension, &granted_permissions);
|
| +
|
| SetPermissions(extension, std::move(granted_permissions),
|
| std::move(withheld_permissions));
|
| }
|
| @@ -243,7 +256,7 @@ void PermissionsUpdater::NotifyPermissionsUpdated(
|
| EventType event_type,
|
| const Extension* extension,
|
| const PermissionSet& changed) {
|
| - DCHECK((init_flag_ & INIT_FLAG_TRANSIENT) == 0);
|
| + DCHECK_EQ(0, init_flag_ & INIT_FLAG_TRANSIENT);
|
| if (changed.IsEmpty())
|
| return;
|
|
|
|
|