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

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

Issue 2184823007: Add a feature which, when enabled, blocks permissions after X prompt dismissals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unify implementation in permission_context_base, make log static Created 4 years, 4 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_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_

Powered by Google App Engine
This is Rietveld 408576698