OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSIONS_BLACKLIST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 typedef base::Callback<void(const BlacklistStateMap&)> | 62 typedef base::Callback<void(const BlacklistStateMap&)> |
63 GetBlacklistedIDsCallback; | 63 GetBlacklistedIDsCallback; |
64 | 64 |
65 typedef base::Callback<void(const std::set<std::string>&)> | 65 typedef base::Callback<void(const std::set<std::string>&)> |
66 GetMalwareIDsCallback; | 66 GetMalwareIDsCallback; |
67 | 67 |
68 typedef base::Callback<void(BlacklistState)> IsBlacklistedCallback; | 68 typedef base::Callback<void(BlacklistState)> IsBlacklistedCallback; |
69 | 69 |
70 explicit Blacklist(ExtensionPrefs* prefs); | 70 explicit Blacklist(ExtensionPrefs* prefs); |
71 | 71 |
72 virtual ~Blacklist(); | 72 ~Blacklist() override; |
73 | 73 |
74 // From the set of extension IDs passed in via |ids|, asynchronously checks | 74 // From the set of extension IDs passed in via |ids|, asynchronously checks |
75 // which are blacklisted and includes them in the resulting map passed | 75 // which are blacklisted and includes them in the resulting map passed |
76 // via |callback|, which will be sent on the caller's message loop. The values | 76 // via |callback|, which will be sent on the caller's message loop. The values |
77 // of the map are the blacklist state for each extension. Extensions with | 77 // of the map are the blacklist state for each extension. Extensions with |
78 // a BlacklistState of NOT_BLACKLISTED are not included in the result. | 78 // a BlacklistState of NOT_BLACKLISTED are not included in the result. |
79 // | 79 // |
80 // For a synchronous version which ONLY CHECKS CURRENTLY INSTALLED EXTENSIONS | 80 // For a synchronous version which ONLY CHECKS CURRENTLY INSTALLED EXTENSIONS |
81 // see ExtensionPrefs::IsExtensionBlacklisted. | 81 // see ExtensionPrefs::IsExtensionBlacklisted. |
82 void GetBlacklistedIDs(const std::set<std::string>& ids, | 82 void GetBlacklistedIDs(const std::set<std::string>& ids, |
(...skipping 22 matching lines...) Expand all Loading... |
105 void AddObserver(Observer* observer); | 105 void AddObserver(Observer* observer); |
106 void RemoveObserver(Observer* observer); | 106 void RemoveObserver(Observer* observer); |
107 | 107 |
108 private: | 108 private: |
109 // Use via ScopedDatabaseManagerForTest. | 109 // Use via ScopedDatabaseManagerForTest. |
110 static void SetDatabaseManager( | 110 static void SetDatabaseManager( |
111 scoped_refptr<SafeBrowsingDatabaseManager> database_manager); | 111 scoped_refptr<SafeBrowsingDatabaseManager> database_manager); |
112 static scoped_refptr<SafeBrowsingDatabaseManager> GetDatabaseManager(); | 112 static scoped_refptr<SafeBrowsingDatabaseManager> GetDatabaseManager(); |
113 | 113 |
114 // content::NotificationObserver | 114 // content::NotificationObserver |
115 virtual void Observe(int type, | 115 void Observe(int type, |
116 const content::NotificationSource& source, | 116 const content::NotificationSource& source, |
117 const content::NotificationDetails& details) override; | 117 const content::NotificationDetails& details) override; |
118 | 118 |
119 void GetBlacklistStateForIDs(const GetBlacklistedIDsCallback& callback, | 119 void GetBlacklistStateForIDs(const GetBlacklistedIDsCallback& callback, |
120 const std::set<std::string>& blacklisted_ids); | 120 const std::set<std::string>& blacklisted_ids); |
121 | 121 |
122 void RequestExtensionsBlacklistState(const std::set<std::string>& ids, | 122 void RequestExtensionsBlacklistState(const std::set<std::string>& ids, |
123 const base::Callback<void()>& callback); | 123 const base::Callback<void()>& callback); |
124 | 124 |
125 void OnBlacklistStateReceived(const std::string& id, BlacklistState state); | 125 void OnBlacklistStateReceived(const std::string& id, BlacklistState state); |
126 | 126 |
127 void ReturnBlacklistStateMap(const GetBlacklistedIDsCallback& callback, | 127 void ReturnBlacklistStateMap(const GetBlacklistedIDsCallback& callback, |
(...skipping 17 matching lines...) Expand all Loading... |
145 // GetBlacklistedIDs and deleted when the callback is called from | 145 // GetBlacklistedIDs and deleted when the callback is called from |
146 // OnBlacklistStateReceived. | 146 // OnBlacklistStateReceived. |
147 StateRequestsList state_requests_; | 147 StateRequestsList state_requests_; |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(Blacklist); | 149 DISALLOW_COPY_AND_ASSIGN(Blacklist); |
150 }; | 150 }; |
151 | 151 |
152 } // namespace extensions | 152 } // namespace extensions |
153 | 153 |
154 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ | 154 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ |
OLD | NEW |