Chromium Code Reviews| 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..2b4117ebee9711467a8e7769b941201f634038c7 100644 |
| --- a/chrome/browser/permissions/permission_context_base.h |
| +++ b/chrome/browser/permissions/permission_context_base.h |
| @@ -30,6 +30,38 @@ class WebContents; |
| using BrowserPermissionCallback = base::Callback<void(ContentSetting)>; |
| +// Identifies the source or reason for a permission status being returned. |
| +enum class PermissionStatusSource { |
|
kcarattini
2017/02/07 22:53:33
Should we have a USER_DECISION value as well?
raymes
2017/02/08 04:08:40
Yes eventually. I didn't want to add it right now
|
| + // The status is the result of being blocked because the requesting origin is |
| + // not https. |
| + INSECURE_ORIGIN, |
| + |
| + // The status is the result of being blocked by the permissions kill switch. |
| + KILL_SWITCH, |
| + |
| + // 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 +115,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, |