| 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 #include "chrome/browser/extensions/blacklist.h" | 5 #include "chrome/browser/extensions/blacklist.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 Blacklist::ScopedDatabaseManagerForTest::~ScopedDatabaseManagerForTest() { | 157 Blacklist::ScopedDatabaseManagerForTest::~ScopedDatabaseManagerForTest() { |
| 158 SetDatabaseManager(original_); | 158 SetDatabaseManager(original_); |
| 159 } | 159 } |
| 160 | 160 |
| 161 Blacklist::Blacklist(ExtensionPrefs* prefs) { | 161 Blacklist::Blacklist(ExtensionPrefs* prefs) { |
| 162 scoped_refptr<SafeBrowsingDatabaseManager> database_manager = | 162 scoped_refptr<SafeBrowsingDatabaseManager> database_manager = |
| 163 g_database_manager.Get().get(); | 163 g_database_manager.Get().get(); |
| 164 if (database_manager.get()) { | 164 if (database_manager.get()) { |
| 165 registrar_.Add( | 165 registrar_.Add( |
| 166 this, | 166 this, chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
| 167 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | |
| 168 content::Source<SafeBrowsingDatabaseManager>(database_manager.get())); | 167 content::Source<SafeBrowsingDatabaseManager>(database_manager.get())); |
| 169 } | 168 } |
| 170 | 169 |
| 171 // Clear out the old prefs-backed blacklist, stored as empty extension entries | 170 // Clear out the old prefs-backed blacklist, stored as empty extension entries |
| 172 // with just a "blacklisted" property. | 171 // with just a "blacklisted" property. |
| 173 // | 172 // |
| 174 // TODO(kalman): Delete this block of code, see http://crbug.com/295882. | 173 // TODO(kalman): Delete this block of code, see http://crbug.com/295882. |
| 175 std::set<std::string> blacklisted = prefs->GetBlacklistedExtensions(); | 174 std::set<std::string> blacklisted = prefs->GetBlacklistedExtensions(); |
| 176 for (std::set<std::string>::iterator it = blacklisted.begin(); | 175 for (std::set<std::string>::iterator it = blacklisted.begin(); |
| 177 it != blacklisted.end(); ++it) { | 176 it != blacklisted.end(); ++it) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 348 } |
| 350 | 349 |
| 351 void Blacklist::Observe(int type, | 350 void Blacklist::Observe(int type, |
| 352 const content::NotificationSource& source, | 351 const content::NotificationSource& source, |
| 353 const content::NotificationDetails& details) { | 352 const content::NotificationDetails& details) { |
| 354 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); | 353 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); |
| 355 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); | 354 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); |
| 356 } | 355 } |
| 357 | 356 |
| 358 } // namespace extensions | 357 } // namespace extensions |
| OLD | NEW |