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

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

Issue 2686463002: Add a source to the result of PermissionContextBase::GetPermissionStatus (Closed)
Patch Set: Add a source to the result of PermissionContextBase::GetPermissionStatus Created 3 years, 10 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_context_base.h
diff --git a/chrome/browser/permissions/permission_context_base.h b/chrome/browser/permissions/permission_context_base.h
index 5b94cccc80c2e9fff8869458eae3590544adcf6b..7ea2e0848dc4457e91e5ccbe89adbaf1dd37250d 100644
--- a/chrome/browser/permissions/permission_context_base.h
+++ b/chrome/browser/permissions/permission_context_base.h
@@ -30,6 +30,32 @@ class WebContents;
using BrowserPermissionCallback = base::Callback<void(ContentSetting)>;
+// Identifies the source or reason for a permission status being returned.
+// TODO(raymes): Add more reasons here and return them correctly.
+enum class PermissionStatusSource {
+ // The status is the result of being blocked due to the user dismissing a
+ // permission prompt multiple times.
+ MULTIPLE_DISMISSALS,
+
+ // The status is the resultof being blocked because the permission is on the
+ // safe browsing blacklist.
+ SAFE_BROWSING_BLACKLIST,
+
+ // The reason for the status is not specified. Avoid returning this value. It
+ // only exists until code has been added to correctly return a source in all
+ // cases.
+ UNSPECIFIED
+};
+
+struct PermissionResult {
+ PermissionResult(ContentSetting content_setting,
+ PermissionStatusSource source);
+ ~PermissionResult();
+
+ ContentSetting content_setting;
+ PermissionStatusSource source;
+};
+
// This base class contains common operations for granting permissions.
// It offers the following functionality:
// - Creates a permission request when needed.
@@ -83,8 +109,8 @@ class PermissionContextBase : public KeyedService {
// Returns whether the permission has been granted, denied etc.
// TODO(meredithl): Ensure that the result accurately reflects whether the
// origin is blacklisted for this permission.
- ContentSetting GetPermissionStatus(const GURL& requesting_origin,
- const GURL& embedding_origin) const;
+ PermissionResult GetPermissionStatus(const GURL& requesting_origin,
+ const GURL& embedding_origin) const;
// Resets the permission to its default value.
virtual void ResetPermission(const GURL& requesting_origin,

Powered by Google App Engine
This is Rietveld 408576698