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

Unified Diff: chrome/browser/permissions/permission_context_base.h

Issue 2555913002: Implement origin specific Permissions Blacklisting. (Closed)
Patch Set: Client inherits RefCountedThreadSafe. Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/permissions/permission_context_base.h
diff --git a/chrome/browser/permissions/permission_context_base.h b/chrome/browser/permissions/permission_context_base.h
index 4f59689dd425a23872194f1ceb4a91e63eebd971..321567ddee232acb017d07b9a11cd7a33fb33694 100644
--- a/chrome/browser/permissions/permission_context_base.h
+++ b/chrome/browser/permissions/permission_context_base.h
@@ -28,6 +28,10 @@ namespace content {
class WebContents;
}
+namespace safe_browsing {
+class SafeBrowsingDatabaseManager;
+}
+
using BrowserPermissionCallback = base::Callback<void(ContentSetting)>;
// This base class contains common operations for granting permissions.
@@ -80,7 +84,9 @@ class PermissionContextBase : public KeyedService {
bool user_gesture,
const BrowserPermissionCallback& callback);
- // Returns whether the permission has been granted, denied...
+ // Returns whether the permission has been granted, denied etc. This method
+ // does not take into account the Safe Browsing blacklist, as it is executed
+ // synchronously.
ContentSetting GetPermissionStatus(const GURL& requesting_origin,
const GURL& embedding_origin) const;
@@ -164,9 +170,27 @@ class PermissionContextBase : public KeyedService {
// Called when a request is no longer used so it can be cleaned up.
void CleanUpRequest(const PermissionRequestID& id);
+ // Called when the requesting origin and permission have been checked by Safe
+ // Browsing. |permission_blocked| determines whether to auto-block the
+ // permission request without prompting the user for a decision.
+ void ContinueRequestPermission(content::WebContents* web_contents,
+ const PermissionRequestID& id,
+ const GURL& requesting_origin,
+ const GURL& embedding_origin,
+ bool user_gesture,
+ const BrowserPermissionCallback& callback,
+ bool permission_blocked);
+
+ void SetSafeBrowsingDatabaseManagerForTests(
raymes 2016/12/20 23:58:57 nit: ForTest (without this s) is a bit more common
meredithl 2016/12/29 06:23:35 Done.
+ scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager);
+
+ void SetTimeoutForSafeBrowsingClient(int timeout);
raymes 2016/12/20 23:58:57 nit: it should be made clear that this is just for
meredithl 2016/12/29 06:23:35 Done.
+
Profile* profile_;
const content::PermissionType permission_type_;
const ContentSettingsType content_settings_type_;
+ int safe_browsing_timeout_;
+ scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager_;
#if defined(OS_ANDROID)
std::unique_ptr<PermissionQueueController> permission_queue_controller_;
#endif

Powered by Google App Engine
This is Rietveld 408576698