| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/safe_browsing_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 void SafeBrowsingService::ShutDown() { | 146 void SafeBrowsingService::ShutDown() { |
| 147 BrowserThread::PostTask( | 147 BrowserThread::PostTask( |
| 148 BrowserThread::IO, FROM_HERE, | 148 BrowserThread::IO, FROM_HERE, |
| 149 NewRunnableMethod(this, &SafeBrowsingService::OnIOShutdown)); | 149 NewRunnableMethod(this, &SafeBrowsingService::OnIOShutdown)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool SafeBrowsingService::CanCheckUrl(const GURL& url) const { | 152 bool SafeBrowsingService::CanCheckUrl(const GURL& url) const { |
| 153 return url.SchemeIs(chrome::kFtpScheme) || | 153 return url.SchemeIs(chrome::kFtpScheme) || |
| 154 url.SchemeIs(chrome::kHttpScheme) || | 154 url.SchemeIs(chrome::kHttpScheme) || |
| 155 url.SchemeIs(chrome::kHttpsScheme); | 155 url.SchemeIs(chrome::kHttpsScheme) || |
| 156 url.SchemeIs(chrome::kHttpsvScheme); |
| 156 } | 157 } |
| 157 | 158 |
| 158 // Only report SafeBrowsing related stats when UMA is enabled and | 159 // Only report SafeBrowsing related stats when UMA is enabled and |
| 159 // safe browsing is enabled. | 160 // safe browsing is enabled. |
| 160 bool SafeBrowsingService::CanReportStats() const { | 161 bool SafeBrowsingService::CanReportStats() const { |
| 161 const MetricsService* metrics = g_browser_process->metrics_service(); | 162 const MetricsService* metrics = g_browser_process->metrics_service(); |
| 162 const PrefService* pref_service = GetDefaultProfile()->GetPrefs(); | 163 const PrefService* pref_service = GetDefaultProfile()->GetPrefs(); |
| 163 return metrics && metrics->reporting_active() && | 164 return metrics && metrics->reporting_active() && |
| 164 pref_service && pref_service->GetBoolean(prefs::kSafeBrowsingEnabled); | 165 pref_service && pref_service->GetBoolean(prefs::kSafeBrowsingEnabled); |
| 165 } | 166 } |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 // checkbox on the blocking page. | 981 // checkbox on the blocking page. |
| 981 void SafeBrowsingService::ReportMalwareDetails( | 982 void SafeBrowsingService::ReportMalwareDetails( |
| 982 scoped_refptr<MalwareDetails> details) { | 983 scoped_refptr<MalwareDetails> details) { |
| 983 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 984 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 984 scoped_ptr<const std::string> serialized(details->GetSerializedReport()); | 985 scoped_ptr<const std::string> serialized(details->GetSerializedReport()); |
| 985 if (!serialized->empty()) { | 986 if (!serialized->empty()) { |
| 986 DVLOG(1) << "Sending serialized malware details."; | 987 DVLOG(1) << "Sending serialized malware details."; |
| 987 protocol_manager_->ReportMalwareDetails(*serialized); | 988 protocol_manager_->ReportMalwareDetails(*serialized); |
| 988 } | 989 } |
| 989 } | 990 } |
| OLD | NEW |