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

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

Issue 8345033: Collect some histograms about signed binary downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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
===================================================================
--- chrome/browser/safe_browsing/download_protection_service.h (revision 106177)
+++ chrome/browser/safe_browsing/download_protection_service.h (working copy)
@@ -18,6 +18,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/time.h"
#include "content/common/net/url_fetcher.h"
#include "googleurl/src/gurl.h"
@@ -36,9 +37,10 @@
: public base::RefCountedThreadSafe<DownloadProtectionService>,
public URLFetcher::Delegate {
public:
- // TODO(noelutz): we're missing some fields here: filename to get
- // the signature, server IPs, tab URL redirect chain, ...
+ // TODO(noelutz): we're missing some fields here: server IPs,
+ // tab URL redirect chain, ...
struct DownloadInfo {
+ FilePath local_file;
std::vector<GURL> download_url_chain;
GURL referrer_url;
std::string sha256_hash;
@@ -62,7 +64,7 @@
// to call SetEnabled() to start it. We keep scoped references to both of
// these objects.
DownloadProtectionService(
- SafeBrowsingService* sb_service,
+ const base::WeakPtr<SafeBrowsingService>& sb_service,
net::URLRequestContextGetter* request_context_getter);
// From the URLFetcher::Delegate interface.
@@ -107,6 +109,7 @@
REASON_INVALID_REQUEST_PROTO,
REASON_SERVER_PING_FAILED,
REASON_INVALID_RESPONSE_PROTO,
+ REASON_NOT_BINARY_FILE,
REASON_MAX // Always add new values before this one.
};
@@ -124,6 +127,11 @@
static const char kDownloadRequestUrl[];
+ // Extracts features from the downloaded file. Runs in the file thread.
+ // When finished, invokes StartCheckClientDownload on the IO thread.
+ void ExtractFileFeatures(const DownloadInfo& info,
+ const CheckDownloadCallback& callback);
+
// Same as above but this method is called on the IO thread after we have
// done some basic checks to see whether the download is definitely not
// safe.
@@ -142,7 +150,7 @@
void SetEnabledOnIOThread(bool enableed);
// This pointer may be NULL if SafeBrowsing is disabled.
- scoped_refptr<SafeBrowsingService> sb_service_;
+ base::WeakPtr<SafeBrowsingService> sb_service_;
// The context we use to issue network requests.
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;

Powered by Google App Engine
This is Rietveld 408576698