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 #include "chrome/browser/media_galleries/fileapi/media_file_validator_factory.h" | 5 #include "chrome/browser/media_galleries/fileapi/media_file_validator_factory.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
9 #include "chrome/browser/media_galleries/fileapi/supported_image_type_validator.
h" | 9 #include "chrome/browser/media_galleries/fileapi/supported_image_type_validator.
h" |
10 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 10 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
11 #include "webkit/browser/fileapi/file_system_url.h" | 11 #include "webkit/browser/fileapi/file_system_url.h" |
12 | 12 |
13 namespace chrome { | 13 namespace chrome { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class InvalidFileValidator : public fileapi::CopyOrMoveFileValidator { | 17 class InvalidFileValidator : public fileapi::CopyOrMoveFileValidator { |
18 public: | 18 public: |
19 virtual ~InvalidFileValidator() {} | 19 virtual ~InvalidFileValidator() {} |
20 virtual void StartValidation( | 20 virtual void StartValidation( |
21 const fileapi::CopyOrMoveFileValidator::ResultCallback& | 21 const fileapi::CopyOrMoveFileValidator::ResultCallback& |
22 result_callback) OVERRIDE { | 22 result_callback) OVERRIDE { |
23 result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); | 23 result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
24 } | 24 } |
25 | 25 |
| 26 virtual void StartPostWriteValidation( |
| 27 const base::FilePath& dest_platform_path, |
| 28 const fileapi::CopyOrMoveFileValidator::ResultCallback& |
| 29 result_callback) OVERRIDE { |
| 30 result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
| 31 } |
| 32 |
26 private: | 33 private: |
27 friend class chrome::MediaFileValidatorFactory; | 34 friend class chrome::MediaFileValidatorFactory; |
28 | 35 |
29 InvalidFileValidator() {} | 36 InvalidFileValidator() {} |
30 | 37 |
31 DISALLOW_COPY_AND_ASSIGN(InvalidFileValidator); | 38 DISALLOW_COPY_AND_ASSIGN(InvalidFileValidator); |
32 }; | 39 }; |
33 | 40 |
34 } // namespace | 41 } // namespace |
35 | 42 |
36 MediaFileValidatorFactory::MediaFileValidatorFactory() {} | 43 MediaFileValidatorFactory::MediaFileValidatorFactory() {} |
37 MediaFileValidatorFactory::~MediaFileValidatorFactory() {} | 44 MediaFileValidatorFactory::~MediaFileValidatorFactory() {} |
38 | 45 |
39 fileapi::CopyOrMoveFileValidator* | 46 fileapi::CopyOrMoveFileValidator* |
40 MediaFileValidatorFactory::CreateCopyOrMoveFileValidator( | 47 MediaFileValidatorFactory::CreateCopyOrMoveFileValidator( |
41 const fileapi::FileSystemURL& src, | 48 const fileapi::FileSystemURL& src, |
42 const base::FilePath& platform_path) { | 49 const base::FilePath& platform_path) { |
43 base::FilePath src_path = src.virtual_path(); | 50 base::FilePath src_path = src.virtual_path(); |
44 if (SupportedImageTypeValidator::SupportsFileType(src_path)) | 51 if (SupportedImageTypeValidator::SupportsFileType(src_path)) |
45 return new SupportedImageTypeValidator(platform_path); | 52 return new SupportedImageTypeValidator(platform_path); |
46 // TODO(vandebo): Support other file types. | 53 // TODO(vandebo): Support other file types. |
47 | 54 |
48 return new InvalidFileValidator(); | 55 return new InvalidFileValidator(); |
49 } | 56 } |
50 | 57 |
51 } // namespace chrome | 58 } // namespace chrome |
OLD | NEW |