| 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 070c9a388d60f8f306e2634c0d0b10ec49cb0483..a42addde6050fa45f5ee9fd5124b5bc485e31d59 100644
|
| --- a/chrome/browser/safe_browsing/download_protection_service.h
|
| +++ b/chrome/browser/safe_browsing/download_protection_service.h
|
| @@ -14,9 +14,11 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/callback.h"
|
| +#include "base/callback_list.h"
|
| #include "base/files/file_path.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "chrome/browser/safe_browsing/database_manager.h"
|
| #include "chrome/browser/safe_browsing/ui_manager.h"
|
| #include "url/gurl.h"
|
| @@ -33,8 +35,9 @@ class X509Certificate;
|
| } // namespace net
|
|
|
| namespace safe_browsing {
|
| -class DownloadFeedbackService;
|
| class BinaryFeatureExtractor;
|
| +class ClientDownloadRequest;
|
| +class DownloadFeedbackService;
|
|
|
| // This class provides an asynchronous API to check whether a particular
|
| // client download is malicious or not.
|
| @@ -52,6 +55,22 @@ class DownloadProtectionService {
|
| // Callback type which is invoked once the download request is done.
|
| typedef base::Callback<void(DownloadCheckResult)> CheckDownloadCallback;
|
|
|
| + // A type of callback run on the main thread when a ClientDownloadRequest has
|
| + // been formed for a download, or when one has not been formed for a supported
|
| + // download.
|
| + typedef base::Callback<void(content::DownloadItem*,
|
| + const ClientDownloadRequest*)>
|
| + ClientDownloadRequestCallback;
|
| +
|
| + // A list of ClientDownloadRequest callbacks.
|
| + typedef base::CallbackList<void(content::DownloadItem*,
|
| + const ClientDownloadRequest*)>
|
| + ClientDownloadRequestCallbackList;
|
| +
|
| + // A subscription to a registered ClientDownloadRequest callback.
|
| + typedef scoped_ptr<ClientDownloadRequestCallbackList::Subscription>
|
| + ClientDownloadRequestSubscription;
|
| +
|
| // Creates a download service. The service is initially disabled. You need
|
| // to call SetEnabled() to start it. |sb_service| owns this object; we
|
| // keep a reference to |request_context_getter|.
|
| @@ -107,6 +126,11 @@ class DownloadProtectionService {
|
| return feedback_service_.get();
|
| }
|
|
|
| + // Registers a callback that will be run when a ClientDownloadRequest has
|
| + // been formed.
|
| + ClientDownloadRequestSubscription RegisterClientDownloadRequestCallback(
|
| + const ClientDownloadRequestCallback& callback);
|
| +
|
| protected:
|
| // Enum to keep track why a particular download verdict was chosen.
|
| // This is used to keep some stats around.
|
| @@ -198,6 +222,10 @@ class DownloadProtectionService {
|
|
|
| scoped_ptr<DownloadFeedbackService> feedback_service_;
|
|
|
| + // A list of callbacks to be run on the main thread when a
|
| + // ClientDownloadRequest has been formed.
|
| + ClientDownloadRequestCallbackList client_download_request_callbacks_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DownloadProtectionService);
|
| };
|
| } // namespace safe_browsing
|
|
|