OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_ | 5 #ifndef WEBKIT_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_ |
6 #define WEBKIT_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_ | 6 #define WEBKIT_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
11 | 11 |
12 namespace fileapi { | 12 namespace fileapi { |
13 | 13 |
14 class CopyOrMoveFileValidator { | 14 class CopyOrMoveFileValidator { |
15 public: | 15 public: |
16 // Callback that is invoked when validation completes. A result of | 16 // Callback that is invoked when validation completes. A result of |
17 // base::PLATFORM_FILE_OK means the file validated. | 17 // base::PLATFORM_FILE_OK means the file validated. |
18 typedef base::Callback<void(base::PlatformFileError result)> ResultCallback; | 18 typedef base::Callback<void(base::PlatformFileError result)> ResultCallback; |
19 | 19 |
20 virtual ~CopyOrMoveFileValidator() {} | 20 virtual ~CopyOrMoveFileValidator() {} |
21 | 21 |
22 virtual void StartValidation(const ResultCallback& result_callback) = 0; | 22 virtual void StartValidation(const ResultCallback& result_callback) = 0; |
23 }; | 23 }; |
24 | 24 |
25 class CopyOrMoveFileValidatorFactory { | 25 class CopyOrMoveFileValidatorFactory { |
26 public: | 26 public: |
27 virtual ~CopyOrMoveFileValidatorFactory() {} | 27 virtual ~CopyOrMoveFileValidatorFactory() {} |
28 | 28 |
29 // This method must always return a non-NULL validator. | 29 // This method must always return a non-NULL validator. |src_url| is needed |
| 30 // in addition to |platform_path| because in the obfuscated file system |
| 31 // case, |platform_path| will be an obfuscated filename and extension. |
30 virtual CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( | 32 virtual CopyOrMoveFileValidator* CreateCopyOrMoveFileValidator( |
| 33 const FileSystemURL& src_url, |
31 const base::FilePath& platform_path) = 0; | 34 const base::FilePath& platform_path) = 0; |
32 }; | 35 }; |
33 | 36 |
34 } // namespace fileapi | 37 } // namespace fileapi |
35 | 38 |
36 #endif // WEBKIT_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_ | 39 #endif // WEBKIT_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_ |
OLD | NEW |