| OLD | NEW |
| (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_DECISION_AUTO_BLOCKER_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_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 PermissionDecisionAutoBlocker { |
| 17 public: |
| 18 static void RemoveCountsByUrl(Profile* profile, |
| 19 base::Callback<bool(const GURL& url)> filter); |
| 20 |
| 21 PermissionDecisionAutoBlocker(); |
| 22 bool ShouldChangeDismissalToBlock(Profile* profile, |
| 23 const GURL& url, |
| 24 content::PermissionType permission); |
| 25 |
| 26 private: |
| 27 friend class PermissionContextBaseTests; |
| 28 friend class PermissionDecisionAutoBlockerUnitTest; |
| 29 |
| 30 static const char kPromptDismissCountKey[]; |
| 31 |
| 32 // Returns the current number of dismissals for |permission| type at |url|. |
| 33 // Exposed for testing. |
| 34 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 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_DECISION_AUTO_BLOCKER_H_ |
| OLD | NEW |