| 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 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "chrome/browser/history/history_service_factory.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/safe_browsing/malware_details.h" | 13 #include "chrome/browser/safe_browsing/malware_details.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
| 16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 19 | 20 |
| 20 using content::BrowserThread; | 21 using content::BrowserThread; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 GetRedirects(*urls_it_); | 81 GetRedirects(*urls_it_); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void MalwareDetailsRedirectsCollector::GetRedirects(const GURL& url) { | 84 void MalwareDetailsRedirectsCollector::GetRedirects(const GURL& url) { |
| 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 85 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 85 if (!profile_) { | 86 if (!profile_) { |
| 86 AllDone(); | 87 AllDone(); |
| 87 return; | 88 return; |
| 88 } | 89 } |
| 89 | 90 |
| 90 HistoryService* history = profile_->GetHistoryService( | 91 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 91 Profile::EXPLICIT_ACCESS); | 92 profile_, Profile::EXPLICIT_ACCESS); |
| 92 if (!history) { | 93 if (!history) { |
| 93 AllDone(); | 94 AllDone(); |
| 94 return; | 95 return; |
| 95 } | 96 } |
| 96 | 97 |
| 97 history->QueryRedirectsTo( | 98 history->QueryRedirectsTo( |
| 98 url, | 99 url, |
| 99 &request_consumer_, | 100 &request_consumer_, |
| 100 base::Bind(&MalwareDetailsRedirectsCollector::OnGotQueryRedirectsTo, | 101 base::Bind(&MalwareDetailsRedirectsCollector::OnGotQueryRedirectsTo, |
| 101 base::Unretained(this))); | 102 base::Unretained(this))); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 125 } | 126 } |
| 126 | 127 |
| 127 GetRedirects(*urls_it_); | 128 GetRedirects(*urls_it_); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void MalwareDetailsRedirectsCollector::AllDone() { | 131 void MalwareDetailsRedirectsCollector::AllDone() { |
| 131 DVLOG(1) << "AllDone"; | 132 DVLOG(1) << "AllDone"; |
| 132 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 133 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
| 133 callback_.Reset(); | 134 callback_.Reset(); |
| 134 } | 135 } |
| OLD | NEW |