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

Side by Side Diff: chrome/browser/permissions/permission_decision_auto_blocker.h

Issue 2250893002: Permission Action Reporting: Add num_prior_* fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@par-new-fields-proto
Patch Set: Also update browsertest 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "content/public/browser/permission_type.h" 10 #include "content/public/browser/permission_type.h"
(...skipping 11 matching lines...) Expand all
22 explicit PermissionDecisionAutoBlocker(Profile* profile); 22 explicit PermissionDecisionAutoBlocker(Profile* profile);
23 23
24 // Records that an ignore of a prompt for |permission| was made. 24 // Records that an ignore of a prompt for |permission| was made.
25 int RecordIgnore(const GURL& url, content::PermissionType permission); 25 int RecordIgnore(const GURL& url, content::PermissionType permission);
26 26
27 // Records that a dismissal of a prompt for |permission| was made, and returns 27 // Records that a dismissal of a prompt for |permission| was made, and returns
28 // true if this dismissal should be considered a block. False otherwise. 28 // true if this dismissal should be considered a block. False otherwise.
29 bool ShouldChangeDismissalToBlock(const GURL& url, 29 bool ShouldChangeDismissalToBlock(const GURL& url,
30 content::PermissionType permission); 30 content::PermissionType permission);
31 31
32 // TODO(kcarattini): This and the below method should really be static.
raymes 2016/08/17 06:08:00 I'd be ok making these 2 functions static. Should
kcarattini 2016/08/17 06:48:45 Done.
33 // Returns the current number of dismisses recorded for |permission|
34 // type at |url|.
35 int GetDismissCount(const GURL& url,
36 content::PermissionType permission);
37
38 // Returns the current number of ignores recorded for |permission|
39 // type at |url|.
40 int GetIgnoreCount(const GURL& url,
41 content::PermissionType permission);
42
32 private: 43 private:
33 friend class PermissionContextBaseTests; 44 friend class PermissionContextBaseTests;
34 friend class PermissionDecisionAutoBlockerUnitTest;
35 friend class RemovePermissionPromptCountsTest;
36 45
37 // Keys used for storing count data in a website setting. 46 // Keys used for storing count data in a website setting.
38 static const char kPromptDismissCountKey[]; 47 static const char kPromptDismissCountKey[];
39 static const char kPromptIgnoreCountKey[]; 48 static const char kPromptIgnoreCountKey[];
40 49
41 // Returns the current number of actions recorded under |key| for |permission| 50 // Returns the current number of actions recorded under |key| for |permission|
42 // type at |url|. 51 // type at |url|.
43 int GetActionCountForTest(const GURL& url, 52 int GetActionCount(const GURL& url,
44 content::PermissionType permission, 53 content::PermissionType permission,
45 const char* key); 54 const char* key);
46 55
47 // Records that the user performed an action for a prompt of type |permission| 56 // Records that the user performed an action for a prompt of type |permission|
48 // on |url| to a website setting keyed by |key|. Returns the total number of 57 // on |url| to a website setting keyed by |key|. Returns the total number of
49 // |key| actions which have been performed for |url|. 58 // |key| actions which have been performed for |url|.
50 int RecordActionInWebsiteSettings(const GURL& url, 59 int RecordActionInWebsiteSettings(const GURL& url,
51 content::PermissionType permission, 60 content::PermissionType permission,
52 const char* key); 61 const char* key);
53 62
54 // Updates |prompt_dismissals_before_block_|. 63 // Updates |prompt_dismissals_before_block_|.
55 void UpdateFromVariations(); 64 void UpdateFromVariations();
56 65
57 Profile *profile_; 66 Profile *profile_;
58 int prompt_dismissals_before_block_; 67 int prompt_dismissals_before_block_;
59 }; 68 };
60 69
61 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ 70 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698