Chromium Code Reviews| Index: chrome/browser/media_galleries/fileapi/scanning_file_validator.h |
| diff --git a/chrome/browser/media_galleries/fileapi/scanning_file_validator.h b/chrome/browser/media_galleries/fileapi/scanning_file_validator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bc3189eb69adb0019f81e6b252d5eb7e4a8fd1ca |
| --- /dev/null |
| +++ b/chrome/browser/media_galleries/fileapi/scanning_file_validator.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SCANNING_FILE_VALIDATOR_H_ |
| +#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SCANNING_FILE_VALIDATOR_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/files/file_path.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
| + |
| +class ImageDecoder; |
|
Lei Zhang
2013/08/03 00:28:26
not used
Greg Billock
2013/08/05 21:42:30
Done.
|
| + |
| +namespace chrome { |
| + |
| +// This class supports AV scanning on post write validation. |
| +class ScanningFileValidator : public fileapi::CopyOrMoveFileValidator { |
|
vandebo (ex-Chrome)
2013/08/05 18:05:30
Scanning file validator is not a very descriptive
Greg Billock
2013/08/05 21:42:30
I meant like "FileValidator that does Validation b
|
| + public: |
| + virtual ~ScanningFileValidator(); |
| + |
| + static bool SupportsFileType(const base::FilePath& path); |
|
vandebo (ex-Chrome)
2013/08/05 18:05:30
No need for this method.
Greg Billock
2013/08/05 21:42:30
Done.
|
| + |
| + // This method will forward to OnFileOpen after the file has been read. |
| + virtual void StartPreWriteValidation( |
|
vandebo (ex-Chrome)
2013/08/05 18:05:30
I did not intend for this to be a fully functional
Greg Billock
2013/08/05 21:42:30
OK. I wasn't sure whether reading the whole file w
|
| + const ResultCallback& result_callback) OVERRIDE; |
| + |
| + // Runs AV checks on the resulting file (Windows-only). |
| + // Subclasses will not typically override this method. |
| + virtual void StartPostWriteValidation( |
| + const base::FilePath& dest_platform_path, |
| + const ResultCallback& result_callback) OVERRIDE; |
| + |
| + protected: |
| + explicit ScanningFileValidator(const base::FilePath& file); |
| + |
| + // Subclasses should do whatever validation they need to on the file |
| + // here. When done, they may use |callback_| to schedule the |
| + // validation reply. Default validation behavior is "can data be read." |
| + virtual void OnFileOpen(scoped_ptr<std::string> data); |
| + |
| + base::FilePath path_; |
| + fileapi::CopyOrMoveFileValidator::ResultCallback callback_; |
| + base::WeakPtrFactory<SupportedImageTypeValidator> weak_factory_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ScanningFileValidator); |
| +}; |
| + |
| +} // namespace chrome |
| + |
| +#endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SCANNING_FILE_VALIDATOR_H_ |