| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 MalwareDetailsRedirectsCollector class. | 5 // Implementation of the MalwareDetailsRedirectsCollector class. |
| 6 | 6 |
| 7 #include "chrome/browser/safe_browsing/malware_details_history.h" | 7 #include "chrome/browser/safe_browsing/malware_details_history.h" |
| 8 | 8 |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/safe_browsing/malware_details.h" | 10 #include "chrome/browser/safe_browsing/malware_details.h" |
| 11 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "content/browser/browser_thread.h" | 12 #include "content/browser/browser_thread.h" |
| 12 #include "content/browser/renderer_host/render_view_host.h" | 13 #include "content/browser/renderer_host/render_view_host.h" |
| 13 #include "content/browser/tab_contents/navigation_entry.h" | 14 #include "content/browser/tab_contents/navigation_entry.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 15 #include "content/browser/tab_contents/tab_contents.h" |
| 15 #include "content/common/notification_details.h" | 16 #include "content/common/notification_details.h" |
| 16 #include "content/common/notification_service.h" | 17 #include "content/common/notification_service.h" |
| 17 #include "content/common/notification_source.h" | 18 #include "content/common/notification_source.h" |
| 18 #include "content/common/notification_type.h" | |
| 19 | 19 |
| 20 MalwareDetailsRedirectsCollector::MalwareDetailsRedirectsCollector( | 20 MalwareDetailsRedirectsCollector::MalwareDetailsRedirectsCollector( |
| 21 Profile* profile) | 21 Profile* profile) |
| 22 : profile_(profile), | 22 : profile_(profile), |
| 23 callback_(NULL), | 23 callback_(NULL), |
| 24 has_started_(false) { | 24 has_started_(false) { |
| 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 26 if (profile) { | 26 if (profile) { |
| 27 registrar_.Add(this, NotificationType::PROFILE_DESTROYED, | 27 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 28 Source<Profile>(profile)); | 28 Source<Profile>(profile)); |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 MalwareDetailsRedirectsCollector::~MalwareDetailsRedirectsCollector() { | 32 MalwareDetailsRedirectsCollector::~MalwareDetailsRedirectsCollector() { |
| 33 } | 33 } |
| 34 | 34 |
| 35 void MalwareDetailsRedirectsCollector::StartHistoryCollection( | 35 void MalwareDetailsRedirectsCollector::StartHistoryCollection( |
| 36 const std::vector<GURL>& urls, | 36 const std::vector<GURL>& urls, |
| 37 Task* callback) { | 37 Task* callback) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 DVLOG(1) << "AllDone"; | 116 DVLOG(1) << "AllDone"; |
| 117 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 117 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
| 118 } | 118 } |
| 119 | 119 |
| 120 const std::vector<safe_browsing::RedirectChain>& | 120 const std::vector<safe_browsing::RedirectChain>& |
| 121 MalwareDetailsRedirectsCollector::GetCollectedUrls() const { | 121 MalwareDetailsRedirectsCollector::GetCollectedUrls() const { |
| 122 return redirects_urls_; | 122 return redirects_urls_; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void MalwareDetailsRedirectsCollector::Observe( | 125 void MalwareDetailsRedirectsCollector::Observe( |
| 126 NotificationType type, | 126 int type, |
| 127 const NotificationSource& source, | 127 const NotificationSource& source, |
| 128 const NotificationDetails& details) { | 128 const NotificationDetails& details) { |
| 129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 130 DCHECK_EQ(type.value, NotificationType::PROFILE_DESTROYED); | 130 DCHECK_EQ(type, chrome::NOTIFICATION_PROFILE_DESTROYED); |
| 131 DVLOG(1) << "Profile gone."; | 131 DVLOG(1) << "Profile gone."; |
| 132 profile_ = NULL; | 132 profile_ = NULL; |
| 133 } | 133 } |
| OLD | NEW |