| Index: chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
|
| diff --git a/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc b/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
|
| index 9ae76253c3bb4db6d4584970202449ed06684405..b5441b31073eae55f78ddb11f948491fd2b65bed 100644
|
| --- a/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
|
| +++ b/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
|
| @@ -16,6 +16,10 @@
|
| #include "chrome/browser/image_decoder.h"
|
| #include "content/public/browser/browser_thread.h"
|
|
|
| +#if defined(OS_WIN)
|
| +#include "base/file_util.h"
|
| +#endif
|
| +
|
| using content::BrowserThread;
|
|
|
| namespace chrome {
|
| @@ -84,6 +88,25 @@ class ImageDecoderDelegateAdapter : public ImageDecoder::Delegate {
|
| DISALLOW_COPY_AND_ASSIGN(ImageDecoderDelegateAdapter);
|
| };
|
|
|
| +#if defined(OS_WIN)
|
| +base::PlatformFileError ScanFile(const base::FilePath& dest_platform_path) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| + base::PlatformFileError result = base::PLATFORM_FILE_OK;
|
| +
|
| + // Execute an AV check of the transferred file. S_OK means
|
| + // the file was OK. Other results may indicate the file was
|
| + // deleted. Any other results, including E_FAIL and
|
| + // INET_E_SECURITY_PROBLEM, are notified as security errors.
|
| + HRESULT scan_result =
|
| + base::ScanAndSaveDownloadedFile(dest_platform_path, std::string());
|
| + if (scan_result != S_OK)
|
| + result = base::PLATFORM_FILE_ERROR_SECURITY;
|
| +
|
| + return result;
|
| +}
|
| +#endif
|
| +
|
| +
|
| } // namespace
|
|
|
| SupportedImageTypeValidator::~SupportedImageTypeValidator() {}
|
| @@ -120,13 +143,16 @@ void SupportedImageTypeValidator::StartPostWriteValidation(
|
| const base::FilePath& dest_platform_path,
|
| const ResultCallback& result_callback) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - post_write_callback_ = result_callback;
|
|
|
| - // TODO(gbillock): Insert AV call here in the right validator.
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO,
|
| +#if defined(OS_WIN)
|
| + BrowserThread::PostTaskAndReplyWithResult(
|
| + BrowserThread::FILE,
|
| FROM_HERE,
|
| - base::Bind(post_write_callback_, base::PLATFORM_FILE_OK));
|
| + base::Bind(&ScanFile, dest_platform_path),
|
| + result_callback);
|
| +#else
|
| + result_callback.Run(base::PLATFORM_FILE_OK);
|
| +#endif
|
| }
|
|
|
| SupportedImageTypeValidator::SupportedImageTypeValidator(
|
|
|