| 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_;
|
|
|