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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 void set(scoped_refptr<SafeBrowsingDatabaseManager> instance) { | 53 void set(scoped_refptr<SafeBrowsingDatabaseManager> instance) { |
54 instance_ = instance; | 54 instance_ = instance; |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 scoped_refptr<SafeBrowsingDatabaseManager> instance_; | 58 scoped_refptr<SafeBrowsingDatabaseManager> instance_; |
59 }; | 59 }; |
60 | 60 |
61 static base::LazyInstance<LazySafeBrowsingDatabaseManager> g_database_manager = | 61 static base::LazyInstance<LazySafeBrowsingDatabaseManager>::DestructorAtExit |
62 LAZY_INSTANCE_INITIALIZER; | 62 g_database_manager = LAZY_INSTANCE_INITIALIZER; |
63 | 63 |
64 // Implementation of SafeBrowsingDatabaseManager::Client, the class which is | 64 // Implementation of SafeBrowsingDatabaseManager::Client, the class which is |
65 // called back from safebrowsing queries. | 65 // called back from safebrowsing queries. |
66 // | 66 // |
67 // Constructed on any thread but lives on the IO from then on. | 67 // Constructed on any thread but lives on the IO from then on. |
68 class SafeBrowsingClientImpl | 68 class SafeBrowsingClientImpl |
69 : public SafeBrowsingDatabaseManager::Client, | 69 : public SafeBrowsingDatabaseManager::Client, |
70 public base::RefCountedThreadSafe<SafeBrowsingClientImpl> { | 70 public base::RefCountedThreadSafe<SafeBrowsingClientImpl> { |
71 public: | 71 public: |
72 typedef base::Callback<void(const std::set<std::string>&)> OnResultCallback; | 72 typedef base::Callback<void(const std::set<std::string>&)> OnResultCallback; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 351 |
352 void Blacklist::Observe(int type, | 352 void Blacklist::Observe(int type, |
353 const content::NotificationSource& source, | 353 const content::NotificationSource& source, |
354 const content::NotificationDetails& details) { | 354 const content::NotificationDetails& details) { |
355 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); | 355 DCHECK_EQ(chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, type); |
356 for (auto& observer : observers_) | 356 for (auto& observer : observers_) |
357 observer.OnBlacklistUpdated(); | 357 observer.OnBlacklistUpdated(); |
358 } | 358 } |
359 | 359 |
360 } // namespace extensions | 360 } // namespace extensions |
OLD | NEW |