OLD | NEW |
---|---|
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 15 matching lines...) Expand all Loading... | |
26 Profile* profile); | 26 Profile* profile); |
27 | 27 |
28 // Returns the current number of ignores recorded for |permission| | 28 // Returns the current number of ignores recorded for |permission| |
29 // type at |url|. | 29 // type at |url|. |
30 static int GetIgnoreCount(const GURL& url, | 30 static int GetIgnoreCount(const GURL& url, |
31 content::PermissionType permission, | 31 content::PermissionType permission, |
32 Profile* profile); | 32 Profile* profile); |
33 | 33 |
34 explicit PermissionDecisionAutoBlocker(Profile* profile); | 34 explicit PermissionDecisionAutoBlocker(Profile* profile); |
35 | 35 |
36 // Records that an ignore of a prompt for |permission| was made. | 36 // Records that an ignore of a prompt for |permission| was made. |
kcarattini
2016/08/23 04:28:46
You may want to clarify where this is recorded, an
dominickn
2016/08/23 20:15:44
Will clarify this in a follow up CL which splits o
| |
37 int RecordIgnore(const GURL& url, content::PermissionType permission); | 37 int RecordIgnore(const GURL& url, content::PermissionType permission); |
38 | 38 |
39 // Records that a dismissal of a prompt for |permission| was made, and returns | 39 // Records that a dismissal of a prompt for |permission| was made, and returns |
40 // true if this dismissal should be considered a block. False otherwise. | 40 // true if this dismissal should be considered a block. False otherwise. |
41 bool ShouldChangeDismissalToBlock(const GURL& url, | 41 bool ShouldChangeDismissalToBlock(const GURL& url, |
42 content::PermissionType permission); | 42 content::PermissionType permission); |
43 | 43 |
44 private: | 44 private: |
45 friend class PermissionContextBaseTests; | 45 friend class PermissionContextBaseTests; |
46 | 46 |
47 // Keys used for storing count data in a website setting. | 47 // Keys used for storing count data in a website setting. |
48 static const char kPromptDismissCountKey[]; | 48 static const char kPromptDismissCountKey[]; |
49 static const char kPromptIgnoreCountKey[]; | 49 static const char kPromptIgnoreCountKey[]; |
50 | 50 |
51 // Returns the current number of actions recorded under |key| for |permission| | |
52 // type at |url|. | |
53 static int GetActionCount(const GURL& url, | |
54 content::PermissionType permission, | |
55 const char* key, | |
56 Profile* profile); | |
57 | |
58 // Records that the user performed an action for a prompt of type |permission| | |
59 // on |url| to a website setting keyed by |key|. Returns the total number of | |
60 // |key| actions which have been performed for |url|. | |
61 int RecordActionInWebsiteSettings(const GURL& url, | |
62 content::PermissionType permission, | |
63 const char* key); | |
64 | |
65 // Updates |prompt_dismissals_before_block_|. | 51 // Updates |prompt_dismissals_before_block_|. |
66 void UpdateFromVariations(); | 52 void UpdateFromVariations(); |
67 | 53 |
68 Profile *profile_; | 54 Profile *profile_; |
69 int prompt_dismissals_before_block_; | 55 int prompt_dismissals_before_block_; |
70 }; | 56 }; |
71 | 57 |
72 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ | 58 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ |
OLD | NEW |