| 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_audio_video_checker.h
" |
| 9 #include "chrome/browser/media_galleries/fileapi/supported_image_type_validator.
h" | 10 #include "chrome/browser/media_galleries/fileapi/supported_image_type_validator.
h" |
| 10 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" | 11 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" |
| 11 #include "webkit/browser/fileapi/file_system_url.h" | 12 #include "webkit/browser/fileapi/file_system_url.h" |
| 12 | 13 |
| 13 namespace chrome { | 14 namespace chrome { |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 class InvalidFileValidator : public fileapi::CopyOrMoveFileValidator { | 18 class InvalidFileValidator : public fileapi::CopyOrMoveFileValidator { |
| 18 public: | 19 public: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 43 MediaFileValidatorFactory::MediaFileValidatorFactory() {} | 44 MediaFileValidatorFactory::MediaFileValidatorFactory() {} |
| 44 MediaFileValidatorFactory::~MediaFileValidatorFactory() {} | 45 MediaFileValidatorFactory::~MediaFileValidatorFactory() {} |
| 45 | 46 |
| 46 fileapi::CopyOrMoveFileValidator* | 47 fileapi::CopyOrMoveFileValidator* |
| 47 MediaFileValidatorFactory::CreateCopyOrMoveFileValidator( | 48 MediaFileValidatorFactory::CreateCopyOrMoveFileValidator( |
| 48 const fileapi::FileSystemURL& src, | 49 const fileapi::FileSystemURL& src, |
| 49 const base::FilePath& platform_path) { | 50 const base::FilePath& platform_path) { |
| 50 base::FilePath src_path = src.virtual_path(); | 51 base::FilePath src_path = src.virtual_path(); |
| 51 if (SupportedImageTypeValidator::SupportsFileType(src_path)) | 52 if (SupportedImageTypeValidator::SupportsFileType(src_path)) |
| 52 return new SupportedImageTypeValidator(platform_path); | 53 return new SupportedImageTypeValidator(platform_path); |
| 53 // TODO(vandebo): Support other file types. | 54 if (SupportedAudioVideoChecker::SupportsFileType(src_path)) |
| 55 return new SupportedAudioVideoChecker(platform_path); |
| 54 | 56 |
| 55 return new InvalidFileValidator(); | 57 return new InvalidFileValidator(); |
| 56 } | 58 } |
| 57 | 59 |
| 58 } // namespace chrome | 60 } // namespace chrome |
| OLD | NEW |