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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 SetDatabaseManager(database_manager); | 153 SetDatabaseManager(database_manager); |
154 } | 154 } |
155 | 155 |
156 Blacklist::ScopedDatabaseManagerForTest::~ScopedDatabaseManagerForTest() { | 156 Blacklist::ScopedDatabaseManagerForTest::~ScopedDatabaseManagerForTest() { |
157 SetDatabaseManager(original_); | 157 SetDatabaseManager(original_); |
158 } | 158 } |
159 | 159 |
160 Blacklist::Blacklist(ExtensionPrefs* prefs) { | 160 Blacklist::Blacklist(ExtensionPrefs* prefs) { |
161 scoped_refptr<SafeBrowsingDatabaseManager> database_manager = | 161 scoped_refptr<SafeBrowsingDatabaseManager> database_manager = |
162 g_database_manager.Get().get(); | 162 g_database_manager.Get().get(); |
163 if (database_manager) { | 163 if (database_manager.get()) { |
164 registrar_.Add( | 164 registrar_.Add( |
165 this, | 165 this, |
166 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 166 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
167 content::Source<SafeBrowsingDatabaseManager>(database_manager.get())); | 167 content::Source<SafeBrowsingDatabaseManager>(database_manager.get())); |
168 } | 168 } |
169 | 169 |
170 // 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 |
171 // with just a "blacklisted" property. | 171 // with just a "blacklisted" property. |
172 // | 172 // |
173 // 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. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 343 } |
344 | 344 |
345 void Blacklist::Observe(int type, | 345 void Blacklist::Observe(int type, |
346 const content::NotificationSource& source, | 346 const content::NotificationSource& source, |
347 const content::NotificationDetails& details) { | 347 const content::NotificationDetails& details) { |
348 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); | 348 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); |
349 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); | 349 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); |
350 } | 350 } |
351 | 351 |
352 } // namespace extensions | 352 } // namespace extensions |
OLD | NEW |