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

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

Issue 2926773002: Check embargo status in PlatformNotificationServiceImpl::CheckPermissionOnIOThread (Closed)
Patch Set: Nits Created 3 years, 6 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.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"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/time/default_clock.h" 12 #include "base/time/default_clock.h"
13 #include "chrome/browser/permissions/permission_result.h" 13 #include "chrome/browser/permissions/permission_result.h"
14 #include "components/content_settings/core/browser/host_content_settings_map.h"
14 #include "components/content_settings/core/common/content_settings_types.h" 15 #include "components/content_settings/core/common/content_settings_types.h"
15 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 16 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
16 #include "components/keyed_service/core/keyed_service.h" 17 #include "components/keyed_service/core/keyed_service.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 class GURL; 20 class GURL;
20 class Profile; 21 class Profile;
21 22
22 namespace content { 23 namespace content {
23 class WebContents; 24 class WebContents;
(...skipping 27 matching lines...) Expand all
51 // BrowserContextKeyedServiceFactory 52 // BrowserContextKeyedServiceFactory
52 KeyedService* BuildServiceInstanceFor( 53 KeyedService* BuildServiceInstanceFor(
53 content::BrowserContext* context) const override; 54 content::BrowserContext* context) const override;
54 55
55 content::BrowserContext* GetBrowserContextToUse( 56 content::BrowserContext* GetBrowserContextToUse(
56 content::BrowserContext* context) const override; 57 content::BrowserContext* context) const override;
57 }; 58 };
58 59
59 static PermissionDecisionAutoBlocker* GetForProfile(Profile* profile); 60 static PermissionDecisionAutoBlocker* GetForProfile(Profile* profile);
60 61
62 // Checks the status of the content setting to determine if |request_origin|
63 // is under embargo for |permission|. This checks both embargo for Permissions
64 // Blacklisting and repeated dismissals. Prefer to use
65 // PermissionManager::GetPermissionStatus when possible. This method is only
66 // exposed to facilitate permission checks from threads other than the
67 // UI thread. See crbug.com/658020.
68 static PermissionResult GetEmbargoResult(HostContentSettingsMap* settings_map,
69 const GURL& request_origin,
70 ContentSettingsType permission,
71 base::Time current_time);
72
61 // Updates the threshold to start blocking prompts from the field trial. 73 // Updates the threshold to start blocking prompts from the field trial.
62 static void UpdateFromVariations(); 74 static void UpdateFromVariations();
63 75
64 // Makes an asynchronous call to Safe Browsing to check the API blacklist. 76 // Makes an asynchronous call to Safe Browsing to check the API blacklist.
65 // Places the (|request_origin|, |permission|) pair under embargo if they are 77 // Places the (|request_origin|, |permission|) pair under embargo if they are
66 // on the blacklist. 78 // on the blacklist.
67 void CheckSafeBrowsingBlacklist(content::WebContents* web_contents, 79 void CheckSafeBrowsingBlacklist(content::WebContents* web_contents,
68 const GURL& request_origin, 80 const GURL& request_origin,
69 ContentSettingsType permission, 81 ContentSettingsType permission,
70 base::Callback<void(bool)> callback); 82 base::Callback<void(bool)> callback);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager_; 152 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager_;
141 153
142 // Timeout in ms. 154 // Timeout in ms.
143 int safe_browsing_timeout_; 155 int safe_browsing_timeout_;
144 156
145 std::unique_ptr<base::Clock> clock_; 157 std::unique_ptr<base::Clock> clock_;
146 158
147 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionDecisionAutoBlocker); 159 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionDecisionAutoBlocker);
148 }; 160 };
149 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ 161 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698