OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // Implementation of the ThreatDetailsRedirectsCollector class. | 5 // Implementation of the ThreatDetailsRedirectsCollector class. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/threat_details_history.h" | 7 #include "chrome/browser/safe_browsing/threat_details_history.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/history/history_service_factory.h" | 12 #include "chrome/browser/history/history_service_factory.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/safe_browsing/threat_details.h" | 14 #include "chrome/browser/safe_browsing/threat_details.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
17 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
18 | 18 |
19 using content::BrowserThread; | 19 using content::BrowserThread; |
20 | 20 |
| 21 namespace safe_browsing { |
| 22 |
21 ThreatDetailsRedirectsCollector::ThreatDetailsRedirectsCollector( | 23 ThreatDetailsRedirectsCollector::ThreatDetailsRedirectsCollector( |
22 Profile* profile) | 24 Profile* profile) |
23 : profile_(profile), has_started_(false) { | 25 : profile_(profile), has_started_(false) { |
24 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 26 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
25 if (profile) { | 27 if (profile) { |
26 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 28 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
27 content::Source<Profile>(profile)); | 29 content::Source<Profile>(profile)); |
28 } | 30 } |
29 } | 31 } |
30 | 32 |
(...skipping 12 matching lines...) Expand all Loading... |
43 BrowserThread::PostTask( | 45 BrowserThread::PostTask( |
44 BrowserThread::UI, FROM_HERE, | 46 BrowserThread::UI, FROM_HERE, |
45 base::Bind(&ThreatDetailsRedirectsCollector::StartGetRedirects, this, | 47 base::Bind(&ThreatDetailsRedirectsCollector::StartGetRedirects, this, |
46 urls)); | 48 urls)); |
47 } | 49 } |
48 | 50 |
49 bool ThreatDetailsRedirectsCollector::HasStarted() const { | 51 bool ThreatDetailsRedirectsCollector::HasStarted() const { |
50 return has_started_; | 52 return has_started_; |
51 } | 53 } |
52 | 54 |
53 const std::vector<safe_browsing::RedirectChain>& | 55 const std::vector<RedirectChain>& |
54 ThreatDetailsRedirectsCollector::GetCollectedUrls() const { | 56 ThreatDetailsRedirectsCollector::GetCollectedUrls() const { |
55 return redirects_urls_; | 57 return redirects_urls_; |
56 } | 58 } |
57 | 59 |
58 void ThreatDetailsRedirectsCollector::Observe( | 60 void ThreatDetailsRedirectsCollector::Observe( |
59 int type, | 61 int type, |
60 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
61 const content::NotificationDetails& details) { | 63 const content::NotificationDetails& details) { |
62 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 64 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
63 DCHECK_EQ(type, chrome::NOTIFICATION_PROFILE_DESTROYED); | 65 DCHECK_EQ(type, chrome::NOTIFICATION_PROFILE_DESTROYED); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 119 } |
118 | 120 |
119 GetRedirects(*urls_it_); | 121 GetRedirects(*urls_it_); |
120 } | 122 } |
121 | 123 |
122 void ThreatDetailsRedirectsCollector::AllDone() { | 124 void ThreatDetailsRedirectsCollector::AllDone() { |
123 DVLOG(1) << "AllDone"; | 125 DVLOG(1) << "AllDone"; |
124 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 126 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
125 callback_.Reset(); | 127 callback_.Reset(); |
126 } | 128 } |
| 129 |
| 130 } // namespace safe_browsing |
OLD | NEW |