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

Unified Diff: chrome/browser/permissions/permission_util.h

Issue 1803973002: Content Settings: Add RevocationObserver to measure when permissions are revoked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rewrite patch in permissions layer Created 4 years, 9 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
Index: chrome/browser/permissions/permission_util.h
diff --git a/chrome/browser/permissions/permission_util.h b/chrome/browser/permissions/permission_util.h
index eb0e066f2484c2825e7ed059fe9ebcb7ac7df00f..b23bea17e0632a2ac03393cd9f53d96904ff4ec4 100644
--- a/chrome/browser/permissions/permission_util.h
+++ b/chrome/browser/permissions/permission_util.h
@@ -8,8 +8,12 @@
#include <string>
#include "base/macros.h"
+#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
+class GURL;
+class Profile;
+
namespace content {
enum class PermissionType;
} // namespace content
@@ -29,6 +33,23 @@ class PermissionUtil {
static bool GetPermissionType(ContentSettingsType type,
content::PermissionType* out);
+ // Helper method which proxies
+ // HostContentSettingsMap::SetContentSettingDefaultScope(). Checks the content
+ // setting value before and after the change to determine whether it has gone
+ // from ALLOW to BLOCK or ASK, and records metrics accordingly. Should be
+ // called from UI code when a user changes permissions for a particular origin
+ // pair. Returns true if the permission was revoked.
+ // TODO(tsergeant): This is a temporary solution to begin gathering metrics.
+ // We should integrate this better with the permissions layer. See
+ // crbug.com/469221.
+ static bool SetContentSettingRecordRevocation(
Bernhard Bauer 2016/03/22 10:13:29 Nit: SetContentSetting*And*RecordRevocation maybe?
tsergeant 2016/03/22 23:55:20 Done.
+ Profile* profile,
+ const GURL& primary_url,
+ const GURL& secondary_url,
+ ContentSettingsType content_type,
+ std::string resource_identifier,
+ ContentSetting setting);
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil);
};

Powered by Google App Engine
This is Rietveld 408576698