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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_DECISION_LOG_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_DECISION_LOG_H_
7
8 #include "base/callback_forward.h"
9 #include "base/macros.h"
10 #include "content/public/browser/permission_type.h"
11 #include "url/gurl.h"
12
13 class GURL;
14 class Profile;
15
16 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.
17 public:
18 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.
19
20 static void RemoveCountsByUrl(Profile* profile,
21 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
22
23 PermissionPromptDecisionLog();
24 bool ShouldChangeDismissalToBlock(Profile* profile,
25 const GURL& url,
26 content::PermissionType permission);
27
28 private:
29 friend class PermissionContextBaseTests;
30 friend class PermissionPromptDecisionLogUnitTest;
31
32 // Returns the current number of dismissals for |permission| type at |url|.
33 // Exposed for testing.
34 static int GetDismissalCount(Profile* profile,
35 const GURL& url,
36 content::PermissionType permission);
37
38 // Records that the user dismissed a permission prompt for type |permission|
39 // on |url| to a website setting. Returns the updated number of dismissals.
40 static int RecordDismissalCount(Profile* profile,
41 const GURL& url,
42 content::PermissionType permission);
43
44 void UpdateFromVariations();
45
46 int prompt_dismissals_before_block_;
47 };
48
49 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_DECISION_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698