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" |
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 Loading... | |
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. This method should only be used if | |
65 // getting the profile-bound PermissionDecisionAutoBlocker object is not | |
66 // possible (e.g. we're on the IO thread). | |
raymes
2017/06/07 02:57:54
nit: The last sentence is a little hard to underst
dominickn
2017/06/08 01:03:04
Done.
| |
67 static PermissionResult GetEmbargoResult(HostContentSettingsMap* settings_map, | |
68 const GURL& request_origin, | |
69 ContentSettingsType permission, | |
70 base::Time current_time); | |
71 | |
61 // Updates the threshold to start blocking prompts from the field trial. | 72 // Updates the threshold to start blocking prompts from the field trial. |
62 static void UpdateFromVariations(); | 73 static void UpdateFromVariations(); |
63 | 74 |
64 // Makes an asynchronous call to Safe Browsing to check the API blacklist. | 75 // Makes an asynchronous call to Safe Browsing to check the API blacklist. |
65 // Places the (|request_origin|, |permission|) pair under embargo if they are | 76 // Places the (|request_origin|, |permission|) pair under embargo if they are |
66 // on the blacklist. | 77 // on the blacklist. |
67 void CheckSafeBrowsingBlacklist(content::WebContents* web_contents, | 78 void CheckSafeBrowsingBlacklist(content::WebContents* web_contents, |
68 const GURL& request_origin, | 79 const GURL& request_origin, |
69 ContentSettingsType permission, | 80 ContentSettingsType permission, |
70 base::Callback<void(bool)> callback); | 81 base::Callback<void(bool)> callback); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager_; | 151 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager_; |
141 | 152 |
142 // Timeout in ms. | 153 // Timeout in ms. |
143 int safe_browsing_timeout_; | 154 int safe_browsing_timeout_; |
144 | 155 |
145 std::unique_ptr<base::Clock> clock_; | 156 std::unique_ptr<base::Clock> clock_; |
146 | 157 |
147 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionDecisionAutoBlocker); | 158 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionDecisionAutoBlocker); |
148 }; | 159 }; |
149 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ | 160 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_DECISION_AUTO_BLOCKER_H_ |
OLD | NEW |