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/string_util.h" |
10 | 10 |
11 MetadataParserJpegFactory::MetadataParserJpegFactory() | 11 MetadataParserJpegFactory::MetadataParserJpegFactory() |
12 : MetadataParserFactory(){} | 12 : MetadataParserFactory(){} |
13 | 13 |
14 MetadataParserJpegFactory::~MetadataParserJpegFactory() {} | |
15 | |
16 bool MetadataParserJpegFactory::CanParse(const FilePath& path, | 14 bool MetadataParserJpegFactory::CanParse(const FilePath& path, |
17 char* bytes, | 15 char* bytes, |
18 int bytes_size) { | 16 int bytes_size) { |
19 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
20 FilePath::StringType ext = UTF8ToWide(std::string(".jpg")); | 18 FilePath::StringType ext = UTF8ToWide(std::string(".jpg")); |
21 #elif defined(OS_POSIX) | 19 #elif defined(OS_POSIX) |
22 FilePath::StringType ext = ".jpg"; | 20 FilePath::StringType ext = ".jpg"; |
23 #endif | 21 #endif |
24 return path.MatchesExtension(ext); | 22 return path.MatchesExtension(ext); |
25 } | 23 } |
26 | 24 |
27 MetadataParser* MetadataParserJpegFactory::CreateParser(const FilePath& path) { | 25 MetadataParser* MetadataParserJpegFactory::CreateParser(const FilePath& path) { |
28 JpegMetadataParser* parser; | 26 JpegMetadataParser* parser; |
29 parser = new JpegMetadataParser(path); | 27 parser = new JpegMetadataParser(path); |
30 return parser; | 28 return parser; |
31 } | 29 } |
OLD | NEW |