OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/parsers/metadata_parser_jpeg_factory.h" | 5 #include "chrome/browser/parsers/metadata_parser_jpeg_factory.h" |
6 | 6 |
7 #include "chrome/browser/parsers/metadata_parser_jpeg.h" | 7 #include "chrome/browser/parsers/metadata_parser_jpeg.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/utf_string_conversions.h" |
10 | 10 |
11 MetadataParserJpegFactory::MetadataParserJpegFactory() | 11 MetadataParserJpegFactory::MetadataParserJpegFactory() |
12 : MetadataParserFactory() { | 12 : MetadataParserFactory() { |
13 } | 13 } |
14 | 14 |
15 bool MetadataParserJpegFactory::CanParse(const FilePath& path, | 15 bool MetadataParserJpegFactory::CanParse(const FilePath& path, |
16 char* bytes, | 16 char* bytes, |
17 int bytes_size) { | 17 int bytes_size) { |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 FilePath::StringType ext = UTF8ToWide(std::string(".jpg")); | 19 FilePath::StringType ext = UTF8ToWide(std::string(".jpg")); |
20 #elif defined(OS_POSIX) | 20 #elif defined(OS_POSIX) |
21 FilePath::StringType ext = ".jpg"; | 21 FilePath::StringType ext = ".jpg"; |
22 #endif | 22 #endif |
23 return path.MatchesExtension(ext); | 23 return path.MatchesExtension(ext); |
24 } | 24 } |
25 | 25 |
26 MetadataParser* MetadataParserJpegFactory::CreateParser(const FilePath& path) { | 26 MetadataParser* MetadataParserJpegFactory::CreateParser(const FilePath& path) { |
27 JpegMetadataParser* parser; | 27 JpegMetadataParser* parser; |
28 parser = new JpegMetadataParser(path); | 28 parser = new JpegMetadataParser(path); |
29 return parser; | 29 return parser; |
30 } | 30 } |
OLD | NEW |