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" | |
| 11 #include "webkit/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( | |
|
Greg Billock
2013/05/22 16:21:59
The signature I'd expect here is StartValidation($
vandebo (ex-Chrome)
2013/05/22 18:41:17
$FILE is passed into the factory so you can create
Greg Billock
2013/05/23 18:18:29
The same validator always gets created, right?
vandebo (ex-Chrome)
2013/05/24 01:13:05
Right now we only have one validator because that'
| |
| 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)) | |
|
Greg Billock
2013/05/22 16:21:59
I'd move all this logic to the SupportedImageTypeV
vandebo (ex-Chrome)
2013/05/22 18:41:17
Not sure what you mean, SupportsFileType is a memb
Greg Billock
2013/05/23 18:18:29
Meaning I'd have this method just return new Suppo
vandebo (ex-Chrome)
2013/05/24 01:13:05
Yes, there will be multiple validators and I will
| |
| 47 return new SupportedImageTypeValidator(platform_path); | |
| 48 // TODO(vandebo) Support other file types. | |
|
Greg Billock
2013/05/22 16:21:59
":"
vandebo (ex-Chrome)
2013/05/22 18:41:17
Done.
| |
| 49 | |
| 50 return new InvalidFileValidator(); | |
| 51 } | |
| 52 | |
| 53 } // namespace chrome | |
| OLD | NEW |