Chromium Code Reviews| Index: chrome/browser/permissions/permission_prompt_decision_log.h |
| diff --git a/chrome/browser/permissions/permission_prompt_decision_log.h b/chrome/browser/permissions/permission_prompt_decision_log.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..480804adee29d0c6873bfc3c6ab3f9fa1563d2ec |
| --- /dev/null |
| +++ b/chrome/browser/permissions/permission_prompt_decision_log.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_DECISION_LOG_H_ |
| +#define CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_DECISION_LOG_H_ |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/macros.h" |
| +#include "content/public/browser/permission_type.h" |
| +#include "url/gurl.h" |
| + |
| +class GURL; |
| +class Profile; |
| + |
| +class PermissionPromptDecisionLog { |
|
raymes
2016/08/05 03:27:48
Sorry this is nitpicky but I think this name will
dominickn
2016/08/05 04:29:30
Done.
|
| + public: |
| + static const char kPromptDismissCountKey[]; |
|
raymes
2016/08/05 03:27:48
nit: this can be private and the test is a friend
dominickn
2016/08/05 04:29:30
Done.
|
| + |
| + static void RemoveCountsByUrl(Profile* profile, |
| + base::Callback<bool(const GURL& url)> filter); |
|
raymes
2016/08/05 03:27:48
Since this object is a singleton, I'd suggest that
dominickn
2016/08/05 04:29:30
RemoveCountsByUrl is called from the BrowsingDataR
|
| + |
| + PermissionPromptDecisionLog(); |
| + bool ShouldChangeDismissalToBlock(Profile* profile, |
| + const GURL& url, |
| + content::PermissionType permission); |
| + |
| + private: |
| + friend class PermissionContextBaseTests; |
| + friend class PermissionPromptDecisionLogUnitTest; |
| + |
| + // Returns the current number of dismissals for |permission| type at |url|. |
| + // Exposed for testing. |
| + static int GetDismissalCount(Profile* profile, |
| + const GURL& url, |
| + content::PermissionType permission); |
| + |
| + // Records that the user dismissed a permission prompt for type |permission| |
| + // on |url| to a website setting. Returns the updated number of dismissals. |
| + static int RecordDismissalCount(Profile* profile, |
| + const GURL& url, |
| + content::PermissionType permission); |
| + |
| + void UpdateFromVariations(); |
| + |
| + int prompt_dismissals_before_block_; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_DECISION_LOG_H_ |