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..56926723f6629238b8f8762279c88af33419799d |
--- /dev/null |
+++ b/chrome/browser/media_galleries/fileapi/scanning_file_validator.h |
@@ -0,0 +1,49 @@ |
+// 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" |
+ |
+namespace chrome { |
+ |
+// This class supports AV scanning on post write validation. |
+class ScanningFileValidator : public fileapi::CopyOrMoveFileValidator { |
+ public: |
+ virtual ~ScanningFileValidator(); |
+ |
+ // This method will forward to OnFileOpen after the file has been read. |
+ virtual void StartPreWriteValidation( |
+ 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_ |