Skip to content

Commit

Permalink
[Extensions c2s] Update notify method name when user permissions change
Browse files Browse the repository at this point in the history
NotifyObserversOfChange() was introduced when PermissiosnManager only
had user site permissions. However, now it covers more permissions
and has multiple observers, so this CL properly renames the notify
method.

Bug: n/a
Change-Id: I2d199cba286d1bcbd4a0f4b750d4dc31f92eb296
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4305620
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Auto-Submit: Emilia Paz <emiliapaz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1112886}
  • Loading branch information
emilia-paz authored and Chromium LUCI CQ committed Mar 3, 2023
1 parent fbc76bf commit 90b1062
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions extensions/browser/permissions_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ void PermissionsManager::OnUserPermissionsSettingsChanged() {
// effect in the network layer.
NetworkPermissionsUpdater::UpdateAllExtensions(
*browser_context_,
base::BindOnce(&PermissionsManager::NotifyObserversOfChange,
base::BindOnce(&PermissionsManager::NotifyUserPermissionSettingsChanged,
weak_factory_.GetWeakPtr()));
}

Expand All @@ -780,9 +780,10 @@ bool PermissionsManager::RemoveRestrictedSiteAndUpdatePrefs(
return removed_site;
}

void PermissionsManager::NotifyObserversOfChange() {
for (auto& observer : observers_)
void PermissionsManager::NotifyUserPermissionSettingsChanged() {
for (auto& observer : observers_) {
observer.OnUserPermissionsSettingsChanged(GetUserPermissionsSettings());
}
}

void PermissionsManager::NotifyShowAccessRequestsInToolbarChanged() {
Expand Down
4 changes: 2 additions & 2 deletions extensions/browser/permissions_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ class PermissionsManager : public KeyedService {
const Extension& extension,
const PermissionSet& user_permitted_set);

// Notifies observers of a permissions change.
void NotifyObserversOfChange();
// Notifies `observers_` that user permissions have changed.
void NotifyUserPermissionSettingsChanged();

base::ObserverList<Observer>::Unchecked observers_;

Expand Down

0 comments on commit 90b1062

Please sign in to comment.