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.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 | 85 |
86 // Records that a dismissal of a prompt for |permission| was made. If the | 86 // Records that a dismissal of a prompt for |permission| was made. If the |
87 // total number of dismissals exceeds a threshhold and | 87 // total number of dismissals exceeds a threshhold and |
88 // features::kBlockPromptsIfDismissedOften is enabled it will place |url| | 88 // features::kBlockPromptsIfDismissedOften is enabled it will place |url| |
89 // under embargo for |permission|. | 89 // under embargo for |permission|. |
90 bool RecordDismissAndEmbargo(const GURL& url, ContentSettingsType permission); | 90 bool RecordDismissAndEmbargo(const GURL& url, ContentSettingsType permission); |
91 | 91 |
92 // Records that an ignore of a prompt for |permission| was made. | 92 // Records that an ignore of a prompt for |permission| was made. |
93 int RecordIgnore(const GURL& url, ContentSettingsType permission); | 93 int RecordIgnore(const GURL& url, ContentSettingsType permission); |
94 | 94 |
95 // Removes the embargo status for the given URL. For permissions embargoed | |
96 // under repeated dismissals, this means a prompt will be shown to the user on | |
97 // next permission request. On blacklisted permissions, the next permission | |
98 // request will re-embargo the permission only if it is still blacklisted. | |
99 // This method assumes |permission| is known to be under embargo. | |
100 void RemoveEmbargoByURL(const GURL& url, ContentSettingsType permission); | |
dominickn
2017/04/03 01:35:30
Nit: call this RemoveEmbargoByUrl.
"Removes the e
Patti Lor
2017/04/05 08:34:27
Done.
| |
101 | |
95 // Removes any recorded counts for urls which match |filter|. | 102 // Removes any recorded counts for urls which match |filter|. |
96 void RemoveCountsByUrl(base::Callback<bool(const GURL& url)> filter); | 103 void RemoveCountsByUrl(base::Callback<bool(const GURL& url)> filter); |
97 | 104 |
98 private: | 105 private: |
99 friend class PermissionContextBaseTests; | 106 friend class PermissionContextBaseTests; |
100 friend class PermissionDecisionAutoBlockerUnitTest; | 107 friend class PermissionDecisionAutoBlockerUnitTest; |
101 | 108 |
102 explicit PermissionDecisionAutoBlocker(Profile* profile); | 109 explicit PermissionDecisionAutoBlocker(Profile* profile); |
103 ~PermissionDecisionAutoBlocker() override; | 110 ~PermissionDecisionAutoBlocker() override; |
104 | 111 |
(...skipping 24 matching lines...) Expand all Loading... | |
129 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager_; | 136 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager_; |
130 | 137 |
131 // Timeout in ms. | 138 // Timeout in ms. |
132 int safe_browsing_timeout_; | 139 int safe_browsing_timeout_; |
133 | 140 |
134 std::unique_ptr<base::Clock> clock_; | 141 std::unique_ptr<base::Clock> clock_; |
135 | 142 |
136 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionDecisionAutoBlocker); | 143 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionDecisionAutoBlocker); |
137 }; | 144 }; |
138 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ | 145 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ |
OLD | NEW |