| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 protected: | 46 protected: |
| 47 virtual ~Observer(); | 47 virtual ~Observer(); |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 Blacklist* blacklist_; | 50 Blacklist* blacklist_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class ScopedDatabaseManagerForTest { | 53 class ScopedDatabaseManagerForTest { |
| 54 public: | 54 public: |
| 55 explicit ScopedDatabaseManagerForTest( | 55 explicit ScopedDatabaseManagerForTest( |
| 56 scoped_refptr<SafeBrowsingDatabaseManager> database_manager); | 56 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> |
| 57 database_manager); |
| 57 | 58 |
| 58 ~ScopedDatabaseManagerForTest(); | 59 ~ScopedDatabaseManagerForTest(); |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 scoped_refptr<SafeBrowsingDatabaseManager> original_; | 62 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> original_; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(ScopedDatabaseManagerForTest); | 64 DISALLOW_COPY_AND_ASSIGN(ScopedDatabaseManagerForTest); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 typedef std::map<std::string, BlacklistState> BlacklistStateMap; | 67 typedef std::map<std::string, BlacklistState> BlacklistStateMap; |
| 67 | 68 |
| 68 typedef base::Callback<void(const BlacklistStateMap&)> | 69 typedef base::Callback<void(const BlacklistStateMap&)> |
| 69 GetBlacklistedIDsCallback; | 70 GetBlacklistedIDsCallback; |
| 70 | 71 |
| 71 typedef base::Callback<void(const std::set<std::string>&)> | 72 typedef base::Callback<void(const std::set<std::string>&)> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // BlacklistStateFetcher. | 110 // BlacklistStateFetcher. |
| 110 BlacklistStateFetcher* ResetBlacklistStateFetcherForTest(); | 111 BlacklistStateFetcher* ResetBlacklistStateFetcherForTest(); |
| 111 | 112 |
| 112 // Adds/removes an observer to the blacklist. | 113 // Adds/removes an observer to the blacklist. |
| 113 void AddObserver(Observer* observer); | 114 void AddObserver(Observer* observer); |
| 114 void RemoveObserver(Observer* observer); | 115 void RemoveObserver(Observer* observer); |
| 115 | 116 |
| 116 private: | 117 private: |
| 117 // Use via ScopedDatabaseManagerForTest. | 118 // Use via ScopedDatabaseManagerForTest. |
| 118 static void SetDatabaseManager( | 119 static void SetDatabaseManager( |
| 119 scoped_refptr<SafeBrowsingDatabaseManager> database_manager); | 120 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> |
| 120 static scoped_refptr<SafeBrowsingDatabaseManager> GetDatabaseManager(); | 121 database_manager); |
| 122 static scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> |
| 123 GetDatabaseManager(); |
| 121 | 124 |
| 122 // content::NotificationObserver | 125 // content::NotificationObserver |
| 123 void Observe(int type, | 126 void Observe(int type, |
| 124 const content::NotificationSource& source, | 127 const content::NotificationSource& source, |
| 125 const content::NotificationDetails& details) override; | 128 const content::NotificationDetails& details) override; |
| 126 | 129 |
| 127 void GetBlacklistStateForIDs(const GetBlacklistedIDsCallback& callback, | 130 void GetBlacklistStateForIDs(const GetBlacklistedIDsCallback& callback, |
| 128 const std::set<std::string>& blacklisted_ids); | 131 const std::set<std::string>& blacklisted_ids); |
| 129 | 132 |
| 130 void RequestExtensionsBlacklistState(const std::set<std::string>& ids, | 133 void RequestExtensionsBlacklistState(const std::set<std::string>& ids, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 153 // GetBlacklistedIDs and deleted when the callback is called from | 156 // GetBlacklistedIDs and deleted when the callback is called from |
| 154 // OnBlacklistStateReceived. | 157 // OnBlacklistStateReceived. |
| 155 StateRequestsList state_requests_; | 158 StateRequestsList state_requests_; |
| 156 | 159 |
| 157 DISALLOW_COPY_AND_ASSIGN(Blacklist); | 160 DISALLOW_COPY_AND_ASSIGN(Blacklist); |
| 158 }; | 161 }; |
| 159 | 162 |
| 160 } // namespace extensions | 163 } // namespace extensions |
| 161 | 164 |
| 162 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ | 165 #endif // CHROME_BROWSER_EXTENSIONS_BLACKLIST_H_ |
| OLD | NEW |