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

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

Issue 512513002: Safebrowsing: send enhanced download protection pings on OSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: always return false for IsSupportedDownload Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index c358eae67cce136603e095bd3d3551cf89569424..0cba9301d7acfbf6778f8d78f19dad9063dce6b4 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -9,6 +9,7 @@
#include "base/format_macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
#include "base/sequenced_task_runner_helpers.h"
@@ -615,7 +616,15 @@ class DownloadProtectionService::CheckClientDownloadRequest
// Currently, the UI only works on Windows so we don't even bother with
// pinging the server if we're not on Windows.
// TODO(noelutz): change this code once the UI is done for Linux and Mac.
-#if defined(OS_WIN)
+#if defined(OS_MACOSX)
+ // TODO(mattm): remove this (see crbug.com/414834).
+ if (base::FieldTrialList::FindFullName("SafeBrowsingOSXClientDownloadPings")
+ != "Enabled") {
+ PostFinishTask(UNKNOWN, REASON_OS_NOT_SUPPORTED);
+ return;
+ }
+#endif
+#if defined(OS_WIN) || defined(OS_MACOSX)
// The URLFetcher is owned by the UI thread, so post a message to
// start the pingback.
BrowserThread::PostTask(
@@ -779,6 +788,13 @@ class DownloadProtectionService::CheckClientDownloadRequest
UMA_HISTOGRAM_ENUMERATION("SBClientDownload.CheckDownloadStats",
reason,
REASON_MAX);
+#if defined(OS_MACOSX)
+ // OSX is currently sending pings only for evaluation purposes, ignore
+ // the result for now.
+ // TODO(mattm): remove this and update the ifdef in
+ // DownloadItemImpl::IsDangerous (see crbug.com/413968).
+ result = UNKNOWN;
+#endif
callback_.Run(result);
item_->RemoveObserver(this);
item_ = NULL;
@@ -928,18 +944,17 @@ void DownloadProtectionService::CheckDownloadUrl(
bool DownloadProtectionService::IsSupportedDownload(
const content::DownloadItem& item,
const base::FilePath& target_path) const {
- // Currently, the UI only works on Windows. On Linux and Mac we still
+ // Currently, the UI is only enabled on Windows. On Mac we send the ping but
+ // ignore the result (see ifdef in FinishRequest). On Linux we still
// want to show the dangerous file type warning if the file is possibly
// dangerous which means we have to always return false here.
#if defined(OS_WIN)
DownloadCheckResultReason reason = REASON_MAX;
ClientDownloadRequest::DownloadType type =
ClientDownloadRequest::WIN_EXECUTABLE;
- return (CheckClientDownloadRequest::IsSupportedDownload(item, target_path,
- &reason, &type) &&
- (ClientDownloadRequest::ANDROID_APK == type ||
- ClientDownloadRequest::WIN_EXECUTABLE == type ||
- ClientDownloadRequest::ZIPPED_EXECUTABLE == type));
+ return (CheckClientDownloadRequest::IsSupportedDownload(
+ item, target_path, &reason, &type) &&
+ (ClientDownloadRequest::CHROME_EXTENSION != type));
#else
return false;
#endif
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698