Chromium Code Reviews| 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 #include "chrome/browser/media_galleries/fileapi/media_file_validator_factory.h" | |
| 6 | |
| 7 #include "base/files/file_path.h" | |
| 8 #include "base/platform_file.h" | |
| 9 #include "chrome/browser/media_galleries/fileapi/supported_image_type_validator. h" | |
| 10 #include "content/public/browser/browser_thread.h" | |
|
Lei Zhang
2013/05/25 00:09:01
not used? ditto with line 14.
vandebo (ex-Chrome)
2013/05/29 06:09:15
Done.
| |
| 11 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | |
| 12 #include "webkit/fileapi/file_system_url.h" | |
| 13 | |
| 14 using content::BrowserThread; | |
| 15 | |
| 16 namespace chrome { | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 class InvalidFileValidator : public fileapi::CopyOrMoveFileValidator { | |
| 21 public: | |
| 22 virtual ~InvalidFileValidator() {} | |
| 23 virtual void StartValidation( | |
| 24 const fileapi::CopyOrMoveFileValidator::ResultCallback& result_callback) { | |
| 25 result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); | |
| 26 } | |
| 27 | |
| 28 private: | |
| 29 friend class chrome::MediaFileValidatorFactory; | |
| 30 | |
| 31 InvalidFileValidator() {} | |
| 32 | |
| 33 DISALLOW_COPY_AND_ASSIGN(InvalidFileValidator); | |
| 34 }; | |
| 35 | |
| 36 } // namespace | |
| 37 | |
| 38 MediaFileValidatorFactory::MediaFileValidatorFactory() {} | |
| 39 MediaFileValidatorFactory::~MediaFileValidatorFactory() {} | |
| 40 | |
| 41 fileapi::CopyOrMoveFileValidator* | |
| 42 MediaFileValidatorFactory::CreateCopyOrMoveFileValidator( | |
| 43 const fileapi::FileSystemURL& src, | |
| 44 const base::FilePath& platform_path) { | |
| 45 base::FilePath src_path = src.virtual_path(); | |
| 46 if (SupportedImageTypeValidator::SupportsFileType(src_path)) | |
| 47 return new SupportedImageTypeValidator(platform_path); | |
| 48 // TODO(vandebo): Support other file types. | |
| 49 | |
| 50 return new InvalidFileValidator(); | |
| 51 } | |
| 52 | |
| 53 } // namespace chrome | |
| OLD | NEW |