| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 sb_service_ = NULL; | 62 sb_service_ = NULL; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void SafeBrowsingUIManager::LogPauseDelay(base::TimeDelta time) { | 65 void SafeBrowsingUIManager::LogPauseDelay(base::TimeDelta time) { |
| 66 UMA_HISTOGRAM_LONG_TIMES("SB2.Delay", time); | 66 UMA_HISTOGRAM_LONG_TIMES("SB2.Delay", time); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Only report SafeBrowsing related stats when UMA is enabled. User must also | 69 // Only report SafeBrowsing related stats when UMA is enabled. User must also |
| 70 // ensure that safe browsing is enabled from the calling profile. | 70 // ensure that safe browsing is enabled from the calling profile. |
| 71 bool SafeBrowsingUIManager::CanReportStats() const { | 71 bool SafeBrowsingUIManager::CanReportStats() const { |
| 72 const MetricsService* metrics = g_browser_process->metrics_service(); | 72 const metrics::MetricsService* metrics = g_browser_process->metrics_service(); |
| 73 return metrics && metrics->reporting_active(); | 73 return metrics && metrics->reporting_active(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void SafeBrowsingUIManager::OnBlockingPageDone( | 76 void SafeBrowsingUIManager::OnBlockingPageDone( |
| 77 const std::vector<UnsafeResource>& resources, | 77 const std::vector<UnsafeResource>& resources, |
| 78 bool proceed) { | 78 bool proceed) { |
| 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 80 for (std::vector<UnsafeResource>::const_iterator iter = resources.begin(); | 80 for (std::vector<UnsafeResource>::const_iterator iter = resources.begin(); |
| 81 iter != resources.end(); ++iter) { | 81 iter != resources.end(); ++iter) { |
| 82 const UnsafeResource& resource = *iter; | 82 const UnsafeResource& resource = *iter; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 resource.threat_type == SB_THREAT_TYPE_URL_MALWARE))) { | 266 resource.threat_type == SB_THREAT_TYPE_URL_MALWARE))) { |
| 267 return entry.domain == | 267 return entry.domain == |
| 268 net::registry_controlled_domains::GetDomainAndRegistry( | 268 net::registry_controlled_domains::GetDomainAndRegistry( |
| 269 resource.url, | 269 resource.url, |
| 270 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 270 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 return false; | 273 return false; |
| 274 } | 274 } |
| 275 | 275 |
| OLD | NEW |