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 #include "chrome/browser/safe_browsing/ui_manager.h" | 5 #include "chrome/browser/safe_browsing/ui_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 const GURL& malicious_url, | 212 const GURL& malicious_url, |
213 const GURL& page_url, | 213 const GURL& page_url, |
214 const GURL& referrer_url, | 214 const GURL& referrer_url, |
215 bool is_subresource, | 215 bool is_subresource, |
216 SBThreatType threat_type, | 216 SBThreatType threat_type, |
217 const std::string& post_data) { | 217 const std::string& post_data) { |
218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
219 | 219 |
220 // The service may delete the ping manager (i.e. when user disabling service, | 220 // The service may delete the ping manager (i.e. when user disabling service, |
221 // etc). This happens on the IO thread. | 221 // etc). This happens on the IO thread. |
222 if (sb_service_ == NULL || sb_service_->ping_manager() == NULL) | 222 if (sb_service_.get() == NULL || sb_service_->ping_manager() == NULL) |
223 return; | 223 return; |
224 | 224 |
225 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url | 225 DVLOG(1) << "ReportSafeBrowsingHit: " << malicious_url << " " << page_url |
226 << " " << referrer_url << " " << is_subresource << " " | 226 << " " << referrer_url << " " << is_subresource << " " |
227 << threat_type; | 227 << threat_type; |
228 sb_service_->ping_manager()->ReportSafeBrowsingHit( | 228 sb_service_->ping_manager()->ReportSafeBrowsingHit( |
229 malicious_url, page_url, | 229 malicious_url, page_url, |
230 referrer_url, is_subresource, | 230 referrer_url, is_subresource, |
231 threat_type, post_data); | 231 threat_type, post_data); |
232 } | 232 } |
233 | 233 |
234 // If the user had opted-in to send MalwareDetails, this gets called | 234 // If the user had opted-in to send MalwareDetails, this gets called |
235 // when the report is ready. | 235 // when the report is ready. |
236 void SafeBrowsingUIManager::SendSerializedMalwareDetails( | 236 void SafeBrowsingUIManager::SendSerializedMalwareDetails( |
237 const std::string& serialized) { | 237 const std::string& serialized) { |
238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
239 | 239 |
240 // The service may delete the ping manager (i.e. when user disabling service, | 240 // The service may delete the ping manager (i.e. when user disabling service, |
241 // etc). This happens on the IO thread. | 241 // etc). This happens on the IO thread. |
242 if (sb_service_ == NULL || sb_service_->ping_manager() == NULL) | 242 if (sb_service_.get() == NULL || sb_service_->ping_manager() == NULL) |
243 return; | 243 return; |
244 | 244 |
245 if (!serialized.empty()) { | 245 if (!serialized.empty()) { |
246 DVLOG(1) << "Sending serialized malware details."; | 246 DVLOG(1) << "Sending serialized malware details."; |
247 sb_service_->ping_manager()->ReportMalwareDetails(serialized); | 247 sb_service_->ping_manager()->ReportMalwareDetails(serialized); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 void SafeBrowsingUIManager::UpdateWhitelist(const UnsafeResource& resource) { | 251 void SafeBrowsingUIManager::UpdateWhitelist(const UnsafeResource& resource) { |
252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 26 matching lines...) Expand all Loading... |
279 (entry.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL && | 279 (entry.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL && |
280 resource.threat_type == SB_THREAT_TYPE_URL_PHISHING))) { | 280 resource.threat_type == SB_THREAT_TYPE_URL_PHISHING))) { |
281 return entry.domain == | 281 return entry.domain == |
282 net::registry_controlled_domains::GetDomainAndRegistry( | 282 net::registry_controlled_domains::GetDomainAndRegistry( |
283 resource.url, | 283 resource.url, |
284 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 284 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
285 } | 285 } |
286 } | 286 } |
287 return false; | 287 return false; |
288 } | 288 } |
OLD | NEW |