| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 ++requests_it; | 310 ++requests_it; |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 void Blacklist::SetBlacklistStateFetcherForTest( | 315 void Blacklist::SetBlacklistStateFetcherForTest( |
| 316 BlacklistStateFetcher* fetcher) { | 316 BlacklistStateFetcher* fetcher) { |
| 317 state_fetcher_.reset(fetcher); | 317 state_fetcher_.reset(fetcher); |
| 318 } | 318 } |
| 319 | 319 |
| 320 BlacklistStateFetcher* Blacklist::ResetBlacklistStateFetcherForTest() { |
| 321 return state_fetcher_.release(); |
| 322 } |
| 323 |
| 320 void Blacklist::AddObserver(Observer* observer) { | 324 void Blacklist::AddObserver(Observer* observer) { |
| 321 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 325 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 322 observers_.AddObserver(observer); | 326 observers_.AddObserver(observer); |
| 323 } | 327 } |
| 324 | 328 |
| 325 void Blacklist::RemoveObserver(Observer* observer) { | 329 void Blacklist::RemoveObserver(Observer* observer) { |
| 326 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 327 observers_.RemoveObserver(observer); | 331 observers_.RemoveObserver(observer); |
| 328 } | 332 } |
| 329 | 333 |
| 330 // static | 334 // static |
| 331 void Blacklist::SetDatabaseManager( | 335 void Blacklist::SetDatabaseManager( |
| 332 scoped_refptr<SafeBrowsingDatabaseManager> database_manager) { | 336 scoped_refptr<SafeBrowsingDatabaseManager> database_manager) { |
| 333 g_database_manager.Get().set(database_manager); | 337 g_database_manager.Get().set(database_manager); |
| 334 } | 338 } |
| 335 | 339 |
| 336 // static | 340 // static |
| 337 scoped_refptr<SafeBrowsingDatabaseManager> Blacklist::GetDatabaseManager() { | 341 scoped_refptr<SafeBrowsingDatabaseManager> Blacklist::GetDatabaseManager() { |
| 338 return g_database_manager.Get().get(); | 342 return g_database_manager.Get().get(); |
| 339 } | 343 } |
| 340 | 344 |
| 341 void Blacklist::Observe(int type, | 345 void Blacklist::Observe(int type, |
| 342 const content::NotificationSource& source, | 346 const content::NotificationSource& source, |
| 343 const content::NotificationDetails& details) { | 347 const content::NotificationDetails& details) { |
| 344 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); | 348 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); |
| 345 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); | 349 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); |
| 346 } | 350 } |
| 347 | 351 |
| 348 } // namespace extensions | 352 } // namespace extensions |
| OLD | NEW |