Chromium Code Reviews| Index: chrome/browser/permissions/permission_manager.cc |
| diff --git a/chrome/browser/permissions/permission_manager.cc b/chrome/browser/permissions/permission_manager.cc |
| index c1a719a45241bd34562014df15d8fad512357426..ed4d423e1469251d014cc8cff07af81457cda7a2 100644 |
| --- a/chrome/browser/permissions/permission_manager.cc |
| +++ b/chrome/browser/permissions/permission_manager.cc |
| @@ -12,6 +12,8 @@ |
| #include "chrome/browser/permissions/permission_context.h" |
| #include "chrome/browser/permissions/permission_context_base.h" |
| #include "chrome/browser/permissions/permission_request_id.h" |
| +#include "chrome/browser/permissions/permission_uma_util.h" |
| +#include "chrome/browser/permissions/permission_util.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/tab_contents/tab_util.h" |
| #include "components/content_settings/core/browser/host_content_settings_map.h" |
| @@ -198,12 +200,16 @@ struct PermissionManager::Subscription { |
| PermissionManager::PermissionManager(Profile* profile) |
| : profile_(profile), |
| weak_ptr_factory_(this) { |
| + HostContentSettingsMapFactory::GetForProfile(profile_)->AddRevocationObserver( |
| + this); |
| } |
| PermissionManager::~PermissionManager() { |
| + HostContentSettingsMap* map = |
| + HostContentSettingsMapFactory::GetForProfile(profile_); |
| + map->RemoveRevocationObserver(this); |
| if (!subscriptions_.IsEmpty()) |
| - HostContentSettingsMapFactory::GetForProfile(profile_) |
| - ->RemoveObserver(this); |
| + map->RemoveObserver(this); |
| } |
| int PermissionManager::RequestPermission( |
| @@ -429,3 +435,14 @@ void PermissionManager::OnContentSettingChanged( |
| for (const auto& callback : callbacks) |
| callback.Run(); |
| } |
| + |
| +void PermissionManager::OnContentSettingRevoked( |
| + const GURL& primary_url, |
| + const GURL& secondary_url, |
| + ContentSettingsType content_type, |
| + std::string resource_identifier) { |
| + PermissionType permission_type; |
| + if (PermissionUtil::GetPermissionType(content_type, &permission_type)) { |
|
raymes
2016/03/17 02:05:43
nit: no {}
tsergeant
2016/03/17 06:25:40
Done.
|
| + PermissionUmaUtil::PermissionRevoked(permission_type, primary_url); |
|
kcarattini
2016/03/17 02:51:22
Is going to change how often revocation is reporte
tsergeant
2016/03/17 06:25:40
Good idea, done.
|
| + } |
| +} |