Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 6023006: Add support to sha256 hash the downloaded file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_service.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_service.cc (revision 70630)
+++ chrome/browser/safe_browsing/safe_browsing_service.cc (working copy)
@@ -47,6 +47,7 @@
const char* const kSbDefaultMacKeyURLPrefix =
"https://sb-ssl.google.com/safebrowsing";
+// TODO(lzheng): Replace this with Profile* ProfileManager::GetDefaultProfile().
Profile* GetDefaultProfile() {
FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
@@ -154,6 +155,20 @@
url.SchemeIs(chrome::kHttpsScheme);
}
+// Only report SafeBrowsing related stats when UMA is enabled and
+// safe browsing is enabled.
+bool SafeBrowsingService::CanReportStats() const {
+ const MetricsService* metrics = g_browser_process->metrics_service();
+ const PrefService* pref_service = GetDefaultProfile()->GetPrefs();
+ return metrics && metrics->reporting_active() &&
+ pref_service && pref_service->GetBoolean(prefs::kSafeBrowsingEnabled);
+}
+
+// Binhash verification is only enabled for UMA users for now.
+bool SafeBrowsingService::DownloadBinHashNeeded() const {
+ return enable_download_protection_ && CanReportStats();
+}
+
void SafeBrowsingService::CheckDownloadUrlDone(
SafeBrowsingCheck* check, UrlCheckResult result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));

Powered by Google App Engine
This is Rietveld 408576698