Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc

Issue 18565002: [FileSystem] Add another copy-or-move validation hook for post-write. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "webkit/common/blob/shareable_file_reference.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:
19 virtual ~InvalidFileValidator() {} 20 virtual ~InvalidFileValidator() {}
20 virtual void StartValidation( 21 virtual void StartValidation(
vandebo (ex-Chrome) 2013/07/10 15:52:46 Should we rename this to StartPreWriteValidation()
Greg Billock 2013/07/11 22:54:35 Not opposed.
vandebo (ex-Chrome) 2013/07/12 15:08:15 But not enthusiastic either?
Greg Billock 2013/07/12 18:02:19 This stage seems more like validation. I can't thi
21 const fileapi::CopyOrMoveFileValidator::ResultCallback& 22 const fileapi::CopyOrMoveFileValidator::ResultCallback&
22 result_callback) OVERRIDE { 23 result_callback) OVERRIDE {
23 result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); 24 result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
24 } 25 }
25 26
27 virtual void StartPostWriteValidation(
28 const base::FilePath& dest_platform_path,
29 scoped_refptr<webkit_blob::ShareableFileReference> file_ref,
30 const fileapi::CopyOrMoveFileValidator::ResultCallback&
31 result_callback) OVERRIDE {
32 result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
33 }
34
26 private: 35 private:
27 friend class chrome::MediaFileValidatorFactory; 36 friend class chrome::MediaFileValidatorFactory;
28 37
29 InvalidFileValidator() {} 38 InvalidFileValidator() {}
30 39
31 DISALLOW_COPY_AND_ASSIGN(InvalidFileValidator); 40 DISALLOW_COPY_AND_ASSIGN(InvalidFileValidator);
32 }; 41 };
33 42
34 } // namespace 43 } // namespace
35 44
36 MediaFileValidatorFactory::MediaFileValidatorFactory() {} 45 MediaFileValidatorFactory::MediaFileValidatorFactory() {}
37 MediaFileValidatorFactory::~MediaFileValidatorFactory() {} 46 MediaFileValidatorFactory::~MediaFileValidatorFactory() {}
38 47
39 fileapi::CopyOrMoveFileValidator* 48 fileapi::CopyOrMoveFileValidator*
40 MediaFileValidatorFactory::CreateCopyOrMoveFileValidator( 49 MediaFileValidatorFactory::CreateCopyOrMoveFileValidator(
41 const fileapi::FileSystemURL& src, 50 const fileapi::FileSystemURL& src,
42 const base::FilePath& platform_path) { 51 const base::FilePath& platform_path) {
43 base::FilePath src_path = src.virtual_path(); 52 base::FilePath src_path = src.virtual_path();
44 if (SupportedImageTypeValidator::SupportsFileType(src_path)) 53 if (SupportedImageTypeValidator::SupportsFileType(src_path))
45 return new SupportedImageTypeValidator(platform_path); 54 return new SupportedImageTypeValidator(platform_path);
46 // TODO(vandebo): Support other file types. 55 // TODO(vandebo): Support other file types.
47 56
48 return new InvalidFileValidator(); 57 return new InvalidFileValidator();
49 } 58 }
50 59
51 } // namespace chrome 60 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698