OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 private: | 49 private: |
50 scoped_refptr<SafeBrowsingDatabaseManager> original_; | 50 scoped_refptr<SafeBrowsingDatabaseManager> original_; |
51 | 51 |
52 DISALLOW_COPY_AND_ASSIGN(ScopedDatabaseManagerForTest); | 52 DISALLOW_COPY_AND_ASSIGN(ScopedDatabaseManagerForTest); |
53 }; | 53 }; |
54 | 54 |
55 typedef base::Callback<void(const std::set<std::string>&)> | 55 typedef base::Callback<void(const std::set<std::string>&)> |
56 GetBlacklistedIDsCallback; | 56 GetBlacklistedIDsCallback; |
57 | 57 |
| 58 typedef base::Callback<void(bool)> IsBlacklistedCallback; |
| 59 |
58 // |prefs_| must outlive this. | 60 // |prefs_| must outlive this. |
59 explicit Blacklist(ExtensionPrefs* prefs); | 61 explicit Blacklist(ExtensionPrefs* prefs); |
60 | 62 |
61 virtual ~Blacklist(); | 63 virtual ~Blacklist(); |
62 | 64 |
63 // From the set of extension IDs passed in via |ids|, asynchronously checks | 65 // From the set of extension IDs passed in via |ids|, asynchronously checks |
64 // which are blacklisted and includes them in the resulting set passed | 66 // which are blacklisted and includes them in the resulting set passed |
65 // via |callback|, which will be sent on the caller's message loop. | 67 // via |callback|, which will be sent on the caller's message loop. |
66 // | 68 // |
67 // For a synchronous version which ONLY CHECKS CURRENTLY INSTALLED EXTENSIONS | 69 // For a synchronous version which ONLY CHECKS CURRENTLY INSTALLED EXTENSIONS |
68 // see ExtensionPrefs::IsExtensionBlacklisted. | 70 // see ExtensionPrefs::IsExtensionBlacklisted. |
69 void GetBlacklistedIDs(const std::set<std::string>& ids, | 71 void GetBlacklistedIDs(const std::set<std::string>& ids, |
70 const GetBlacklistedIDsCallback& callback); | 72 const GetBlacklistedIDsCallback& callback); |
71 | 73 |
| 74 // More convenient form of GetBlacklistedIDs for checking a single extension. |
| 75 void IsBlacklisted(const std::string& extension_id, |
| 76 const IsBlacklistedCallback& callback); |
| 77 |
72 // Sets the blacklist from the updater to contain the extension IDs in |ids| | 78 // Sets the blacklist from the updater to contain the extension IDs in |ids| |
73 void SetFromUpdater(const std::vector<std::string>& ids, | 79 void SetFromUpdater(const std::vector<std::string>& ids, |
74 const std::string& version); | 80 const std::string& version); |
75 | 81 |
76 // Adds/removes an observer to the blacklist. | 82 // Adds/removes an observer to the blacklist. |
77 void AddObserver(Observer* observer); | 83 void AddObserver(Observer* observer); |
78 void RemoveObserver(Observer* observer); | 84 void RemoveObserver(Observer* observer); |
79 | 85 |
80 private: | 86 private: |
81 // Use via ScopedDatabaseManagerForTest. | 87 // Use via ScopedDatabaseManagerForTest. |
(...skipping 21 matching lines...) Expand all Loading... |
103 std::set<std::string> prefs_blacklist_; | 109 std::set<std::string> prefs_blacklist_; |
104 | 110 |
105 content::NotificationRegistrar registrar_; | 111 content::NotificationRegistrar registrar_; |
106 | 112 |
107 DISALLOW_COPY_AND_ASSIGN(Blacklist); | 113 DISALLOW_COPY_AND_ASSIGN(Blacklist); |
108 }; | 114 }; |
109 | 115 |
110 } // namespace extensions | 116 } // namespace extensions |
111 | 117 |
112 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ | 118 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ |
OLD | NEW |