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

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

Issue 2029903002: Add token field to ClientSafeBrowsingReportReqeust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit in test Created 4 years, 6 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/download_protection_service.h
diff --git a/chrome/browser/safe_browsing/download_protection_service.h b/chrome/browser/safe_browsing/download_protection_service.h
index fffc858f19bd9b9fe8843acd6b4cd34f38708822..83ed3596582f8b377d946503aa4e964a94bfbeb4 100644
--- a/chrome/browser/safe_browsing/download_protection_service.h
+++ b/chrome/browser/safe_browsing/download_protection_service.h
@@ -22,6 +22,7 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/supports_user_data.h"
#include "chrome/browser/safe_browsing/ui_manager.h"
#include "components/safe_browsing_db/database_manager.h"
#include "net/url_request/url_request_context_getter.h"
@@ -92,8 +93,9 @@ class DownloadProtectionService {
// method must be called on the UI thread, and the callback will also be
// invoked on the UI thread. This method must be called once the download
// is finished and written to disk.
- virtual void CheckClientDownload(content::DownloadItem* item,
- const CheckDownloadCallback& callback);
+ virtual void CheckClientDownload(
+ content::DownloadItem* item,
+ const CheckDownloadCallback& callback);
// Checks whether any of the URLs in the redirect chain of the
// download match the SafeBrowsing bad binary URL list. The result is
@@ -148,6 +150,11 @@ class DownloadProtectionService {
return whitelist_sample_rate_;
}
+ static void SetDownloadPingToken(content::DownloadItem* item,
+ const std::string& token);
+
+ static std::string GetDownloadPingToken(const content::DownloadItem* item);
+
protected:
// Enum to keep track why a particular download verdict was chosen.
// This is used to keep some stats around.
@@ -183,6 +190,7 @@ class DownloadProtectionService {
class CheckClientDownloadRequest;
class PPAPIDownloadRequest;
friend class DownloadProtectionServiceTest;
+ friend class DownloadDangerPromptTest;
FRIEND_TEST_ALL_PREFIXES(DownloadProtectionServiceTest,
CheckClientDownloadWhitelistedUrlWithoutSampling);
@@ -215,6 +223,23 @@ class DownloadProtectionService {
static const char kDownloadRequestUrl[];
+ static const void* const kDownloadPingTokenKey;
+
+ // Helper class for easy setting and getting token string.
+ class DownloadPingToken : public base::SupportsUserData::Data {
+ public:
+ explicit DownloadPingToken(const std::string& token)
+ : token_string_(token) {}
+
+ std::string token_string() {
+ return token_string_;
+ }
+ private:
+ std::string token_string_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadPingToken);
+ };
+
// Cancels all requests in |download_requests_|, and empties it, releasing
// the references to the requests.
void CancelPendingRequests();

Powered by Google App Engine
This is Rietveld 408576698