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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SUPPORTED_IMAGE_TYPE_VALIDATOR_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SUPPORTED_IMAGE_TYPE_VALIDATOR_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SUPPORTED_IMAGE_TYPE_VALIDATOR_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SUPPORTED_IMAGE_TYPE_VALIDATOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/media_galleries/fileapi/av_scanning_file_validator.h" | 12 #include "chrome/browser/media_galleries/fileapi/av_scanning_file_validator.h" |
13 | 13 |
14 class ImageDecoder; | 14 class ImageDecoder; |
15 | 15 |
16 class MediaFileValidatorFactory; | 16 class MediaFileValidatorFactory; |
17 | 17 |
18 // Use ImageDecoder to determine if the file decodes without error. Handles | 18 // Use ImageDecoder to determine if the file decodes without error. Handles |
19 // image files supported by Chrome. | 19 // image files supported by Chrome. |
20 class SupportedImageTypeValidator : public AVScanningFileValidator { | 20 class SupportedImageTypeValidator : public AVScanningFileValidator { |
21 public: | 21 public: |
22 virtual ~SupportedImageTypeValidator(); | 22 virtual ~SupportedImageTypeValidator(); |
23 | 23 |
24 static bool SupportsFileType(const base::FilePath& path); | 24 static bool SupportsFileType(const base::FilePath& path); |
25 | 25 |
26 virtual void StartPreWriteValidation( | 26 virtual void StartPreWriteValidation( |
27 const ResultCallback& result_callback) OVERRIDE; | 27 const ResultCallback& result_callback) override; |
28 | 28 |
29 private: | 29 private: |
30 friend class MediaFileValidatorFactory; | 30 friend class MediaFileValidatorFactory; |
31 | 31 |
32 explicit SupportedImageTypeValidator(const base::FilePath& file); | 32 explicit SupportedImageTypeValidator(const base::FilePath& file); |
33 | 33 |
34 void OnFileOpen(scoped_ptr<std::string> data); | 34 void OnFileOpen(scoped_ptr<std::string> data); |
35 | 35 |
36 base::FilePath path_; | 36 base::FilePath path_; |
37 scoped_refptr<ImageDecoder> decoder_; | 37 scoped_refptr<ImageDecoder> decoder_; |
38 storage::CopyOrMoveFileValidator::ResultCallback callback_; | 38 storage::CopyOrMoveFileValidator::ResultCallback callback_; |
39 base::WeakPtrFactory<SupportedImageTypeValidator> weak_factory_; | 39 base::WeakPtrFactory<SupportedImageTypeValidator> weak_factory_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(SupportedImageTypeValidator); | 41 DISALLOW_COPY_AND_ASSIGN(SupportedImageTypeValidator); |
42 }; | 42 }; |
43 | 43 |
44 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SUPPORTED_IMAGE_TYPE_VALIDATOR
_H_ | 44 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_SUPPORTED_IMAGE_TYPE_VALIDATOR
_H_ |
OLD | NEW |