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 16 matching lines...) Expand all Loading... |
27 namespace extensions { | 27 namespace extensions { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // The safe browsing database manager to use. Make this a global/static variable | 31 // The safe browsing database manager to use. Make this a global/static variable |
32 // rather than a member of Blacklist because Blacklist accesses the real | 32 // rather than a member of Blacklist because Blacklist accesses the real |
33 // database manager before it has a chance to get a fake one. | 33 // database manager before it has a chance to get a fake one. |
34 class LazySafeBrowsingDatabaseManager { | 34 class LazySafeBrowsingDatabaseManager { |
35 public: | 35 public: |
36 LazySafeBrowsingDatabaseManager() { | 36 LazySafeBrowsingDatabaseManager() { |
37 #if defined(FULL_SAFE_BROWSING) || defined(MOBILE_SAFE_BROWSING) | 37 #if defined(SAFE_BROWSING_DB_LOCAL) |
38 if (g_browser_process && g_browser_process->safe_browsing_service()) { | 38 if (g_browser_process && g_browser_process->safe_browsing_service()) { |
39 instance_ = | 39 instance_ = |
40 g_browser_process->safe_browsing_service()->database_manager(); | 40 g_browser_process->safe_browsing_service()->database_manager(); |
41 } | 41 } |
42 #endif | 42 #endif |
43 } | 43 } |
44 | 44 |
45 scoped_refptr<SafeBrowsingDatabaseManager> get() { | 45 scoped_refptr<SafeBrowsingDatabaseManager> get() { |
46 return instance_; | 46 return instance_; |
47 } | 47 } |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 347 } |
348 | 348 |
349 void Blacklist::Observe(int type, | 349 void Blacklist::Observe(int type, |
350 const content::NotificationSource& source, | 350 const content::NotificationSource& source, |
351 const content::NotificationDetails& details) { | 351 const content::NotificationDetails& details) { |
352 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); | 352 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); |
353 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); | 353 FOR_EACH_OBSERVER(Observer, observers_, OnBlacklistUpdated()); |
354 } | 354 } |
355 | 355 |
356 } // namespace extensions | 356 } // namespace extensions |
OLD | NEW |