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.
5 #ifndef STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_
6 #define STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_
8 #include "base/callback.h"
9 #include "base/files/file.h"
10 #include "storage/browser/storage_browser_export.h"
20 class STORAGE_EXPORT CopyOrMoveFileValidator
{
22 // Callback that is invoked when validation completes. A result of
23 // base::File::FILE_OK means the file validated.
24 typedef base::Callback
<void(base::File::Error result
)> ResultCallback
;
26 virtual ~CopyOrMoveFileValidator() {}
28 // Called on a source file before copying or moving to the final
30 virtual void StartPreWriteValidation(
31 const ResultCallback
& result_callback
) = 0;
33 // Called on a destination file after copying or moving to the final
34 // destination. Suitable for running Anti-Virus checks.
35 virtual void StartPostWriteValidation(
36 const base::FilePath
& dest_platform_path
,
37 const ResultCallback
& result_callback
) = 0;
40 class CopyOrMoveFileValidatorFactory
{
42 virtual ~CopyOrMoveFileValidatorFactory() {}
44 // This method must always return a non-NULL validator. |src_url| is needed
45 // in addition to |platform_path| because in the obfuscated file system
46 // case, |platform_path| will be an obfuscated filename and extension.
47 virtual CopyOrMoveFileValidator
* CreateCopyOrMoveFileValidator(
48 const FileSystemURL
& src_url
,
49 const base::FilePath
& platform_path
) = 0;
52 } // namespace storage
54 #endif // STORAGE_BROWSER_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_