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

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

Issue 2640033006: Convert AutoBlocker static class to KeyedService. (Closed)
Patch Set: Git surgery. Created 3 years, 11 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_BLACKLIST_CLIENT_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_BLACKLIST_CLIENT_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_BLACKLIST_CLIENT_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_BLACKLIST_CLIENT_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/permissions/permission_util.h" 10 #include "chrome/browser/permissions/permission_util.h"
(...skipping 13 matching lines...) Expand all
24 24
25 // The client used when checking whether a permission has been blacklisted by 25 // The client used when checking whether a permission has been blacklisted by
26 // Safe Browsing. The check is done asynchronously as no state can be stored in 26 // Safe Browsing. The check is done asynchronously as no state can be stored in
27 // PermissionContextBase (since additional permission requests may be made). 27 // PermissionContextBase (since additional permission requests may be made).
28 // This class must be created and destroyed on the UI thread. 28 // This class must be created and destroyed on the UI thread.
29 class PermissionBlacklistClient 29 class PermissionBlacklistClient
30 : public safe_browsing::SafeBrowsingDatabaseManager::Client, 30 : public safe_browsing::SafeBrowsingDatabaseManager::Client,
31 public base::RefCountedThreadSafe<PermissionBlacklistClient>, 31 public base::RefCountedThreadSafe<PermissionBlacklistClient>,
32 public content::WebContentsObserver { 32 public content::WebContentsObserver {
33 public: 33 public:
34 // |callback| will not be called if |web_contents| is destroyed. Thus if the
35 // callback is run, the profile associated with |web_contents| is guaranteed
36 // to be alive.
34 static void CheckSafeBrowsingBlacklist( 37 static void CheckSafeBrowsingBlacklist(
35 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager, 38 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> db_manager,
36 content::PermissionType permission_type, 39 content::PermissionType permission_type,
37 const GURL& request_origin, 40 const GURL& request_origin,
38 content::WebContents* web_contents, 41 content::WebContents* web_contents,
39 int timeout, 42 int timeout,
40 base::Callback<void(bool)> callback); 43 base::Callback<void(bool)> callback);
41 44
42 private: 45 private:
43 friend class base::RefCountedThreadSafe<PermissionBlacklistClient>; 46 friend class base::RefCountedThreadSafe<PermissionBlacklistClient>;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 int timeout_; 81 int timeout_;
79 82
80 // True if |callback_| should be invoked, if web_contents() is destroyed, this 83 // True if |callback_| should be invoked, if web_contents() is destroyed, this
81 // is set to false. 84 // is set to false.
82 bool is_active_; 85 bool is_active_;
83 86
84 DISALLOW_COPY_AND_ASSIGN(PermissionBlacklistClient); 87 DISALLOW_COPY_AND_ASSIGN(PermissionBlacklistClient);
85 }; 88 };
86 89
87 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_BLACKLIST_CLIENT_H_ 90 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_BLACKLIST_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698