OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SCANNING_FILE_VALIDATOR_H_ |
| 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SCANNING_FILE_VALIDATOR_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
| 13 |
| 14 namespace chrome { |
| 15 |
| 16 // This class supports AV scanning on post write validation. |
| 17 class ScanningFileValidator : public fileapi::CopyOrMoveFileValidator { |
| 18 public: |
| 19 virtual ~ScanningFileValidator(); |
| 20 |
| 21 // This method will forward to OnFileOpen after the file has been read. |
| 22 virtual void StartPreWriteValidation( |
| 23 const ResultCallback& result_callback) OVERRIDE; |
| 24 |
| 25 // Runs AV checks on the resulting file (Windows-only). |
| 26 // Subclasses will not typically override this method. |
| 27 virtual void StartPostWriteValidation( |
| 28 const base::FilePath& dest_platform_path, |
| 29 const ResultCallback& result_callback) OVERRIDE; |
| 30 |
| 31 protected: |
| 32 explicit ScanningFileValidator(const base::FilePath& file); |
| 33 |
| 34 // Subclasses should do whatever validation they need to on the file |
| 35 // here. When done, they may use |callback_| to schedule the |
| 36 // validation reply. Default validation behavior is "can data be read." |
| 37 virtual void OnFileOpen(scoped_ptr<std::string> data); |
| 38 |
| 39 base::FilePath path_; |
| 40 fileapi::CopyOrMoveFileValidator::ResultCallback callback_; |
| 41 base::WeakPtrFactory<SupportedImageTypeValidator> weak_factory_; |
| 42 |
| 43 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(ScanningFileValidator); |
| 45 }; |
| 46 |
| 47 } // namespace chrome |
| 48 |
| 49 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SCANNING_FILE_VALIDATOR_H_ |
OLD | NEW |